From a11c93e929c40c955696f6d8132bb24c325b1659 Mon Sep 17 00:00:00 2001 From: Manuel Guenther <manuel.guenther@idiap.ch> Date: Tue, 16 Jun 2015 18:44:01 +0200 Subject: [PATCH] Applied new command line option strategy --- bob/bio/gmm/script/verify_gmm.py | 8 ++++---- bob/bio/gmm/script/verify_isv.py | 8 ++++---- bob/bio/gmm/script/verify_ivector.py | 8 ++++---- bob/bio/gmm/test/test_scripts.py | 3 +-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/bob/bio/gmm/script/verify_gmm.py b/bob/bio/gmm/script/verify_gmm.py index 830f07e..c1683b2 100644 --- a/bob/bio/gmm/script/verify_gmm.py +++ b/bob/bio/gmm/script/verify_gmm.py @@ -220,9 +220,9 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return {} else: # add jobs - submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_gmm.py', first_fake_job_id = 0) if args.grid else None + submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_gmm.py', first_fake_job_id = 0) retval = tools.add_jobs(args, submitter, local_job_adder = add_gmm_jobs) - base_tools.write_info(args, command_line_parameters) + base_tools.write_info(args, command_line_parameters, submitter.executable) if args.grid.is_local() and args.run_local_scheduler: if args.dry_run: @@ -237,11 +237,11 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return retval -def main(command_line_parameters = sys.argv): +def main(command_line_parameters = None): """Executes the main function""" try: # do the command line parsing - args = parse_arguments(command_line_parameters[1:]) + args = parse_arguments(command_line_parameters) # perform face verification test verify(args, command_line_parameters) diff --git a/bob/bio/gmm/script/verify_isv.py b/bob/bio/gmm/script/verify_isv.py index e522c71..cd65f55 100644 --- a/bob/bio/gmm/script/verify_isv.py +++ b/bob/bio/gmm/script/verify_isv.py @@ -146,9 +146,9 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return {} else: # add jobs - submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_isv.py', first_fake_job_id = 0) if args.grid else None + submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_isv.py', first_fake_job_id = 0) retval = tools.add_jobs(args, submitter, local_job_adder = add_isv_jobs) - base_tools.write_info(args, command_line_parameters) + base_tools.write_info(args, command_line_parameters, submitter.executable) if args.grid.is_local() and args.run_local_scheduler: if args.dry_run: @@ -163,11 +163,11 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return retval -def main(command_line_parameters = sys.argv): +def main(command_line_parameters = None): """Executes the main function""" try: # do the command line parsing - args = parse_arguments(command_line_parameters[1:]) + args = parse_arguments(command_line_parameters) # perform face verification test verify(args, command_line_parameters) diff --git a/bob/bio/gmm/script/verify_ivector.py b/bob/bio/gmm/script/verify_ivector.py index 0dcd22e..5081c5a 100644 --- a/bob/bio/gmm/script/verify_ivector.py +++ b/bob/bio/gmm/script/verify_ivector.py @@ -197,9 +197,9 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return {} else: # add jobs - submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_ivector.py', first_fake_job_id = 0) if args.grid else None + submitter = base_tools.GridSubmission(args, command_line_parameters, executable = 'verify_ivector.py', first_fake_job_id = 0) retval = tools.add_jobs(args, submitter, local_job_adder = add_ivector_jobs) - base_tools.write_info(args, command_line_parameters) + base_tools.write_info(args, command_line_parameters, submitter.executable) if args.grid.is_local() and args.run_local_scheduler: if args.dry_run: @@ -214,11 +214,11 @@ def verify(args, command_line_parameters, external_fake_job_id = 0): return retval -def main(command_line_parameters = sys.argv): +def main(command_line_parameters = None): """Executes the main function""" try: # do the command line parsing - args = parse_arguments(command_line_parameters[1:]) + args = parse_arguments(command_line_parameters) # perform face verification test verify(args, command_line_parameters) diff --git a/bob/bio/gmm/test/test_scripts.py b/bob/bio/gmm/test/test_scripts.py index af81c56..34adb9c 100644 --- a/bob/bio/gmm/test/test_scripts.py +++ b/bob/bio/gmm/test/test_scripts.py @@ -3,7 +3,6 @@ from __future__ import print_function import bob.measure import os -import sys import shutil import tempfile import numpy @@ -24,7 +23,7 @@ data_dir = pkg_resources.resource_filename('bob.bio.gmm', 'test/data') def _verify(parameters, test_dir, sub_dir, ref_modifier="", score_modifier=('scores',''), executable = main): try: - executable([sys.argv[0]] + parameters) + executable(parameters) # assert that the score file exists score_files = [os.path.join(test_dir, sub_dir, 'Default', norm, '%s-dev%s'%score_modifier) for norm in ('nonorm', 'ztnorm')] -- GitLab