From 8ab1612d68e11c2952b458582305568efac86435 Mon Sep 17 00:00:00 2001 From: Tiago Freitas Pereira <tiagofrepereira@gmail.com> Date: Fri, 22 Apr 2016 16:52:05 +0200 Subject: [PATCH] Solving issue #14 and added the argument --environment --- bob/bio/base/tools/command_line.py | 2 ++ bob/bio/base/tools/grid.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/bob/bio/base/tools/command_line.py b/bob/bio/base/tools/command_line.py index d584083a..40e58832 100644 --- a/bob/bio/base/tools/command_line.py +++ b/bob/bio/base/tools/command_line.py @@ -139,6 +139,8 @@ def command_line_parser(description=__doc__, exclude_resources_from=[]): help = "If given, missing files will not stop the processing; this is helpful if not all files of the database can be processed; missing scores will be NaN.") flag_group.add_argument('-r', '--parallel', type=int, help = 'This flag is a shortcut for running the commands on the local machine with the given amount of parallel threads; equivalent to --grid bob.bio.base.grid.Grid("local", number_of_parallel_threads=X) --run-local-scheduler --stop-on-failure.') + + flag_group.add_argument('-s', '--environment', dest='env', nargs='*', default=[], help='Passes specific environment variables to the job.') return { 'main' : parser, diff --git a/bob/bio/base/tools/grid.py b/bob/bio/base/tools/grid.py index 05cde15c..cb04d88a 100644 --- a/bob/bio/base/tools/grid.py +++ b/bob/bio/base/tools/grid.py @@ -49,6 +49,8 @@ class GridSubmission: if args.grid is not None: assert isinstance(args.grid, grid.Grid) + + self.env = args.env #Fetching the enviroment variable # find, where jman is installed jmans = bob.extension.find_executable('jman', prefixes = ['bin']) @@ -93,6 +95,9 @@ class GridSubmission: # submit the job to the job manager if not self.args.dry_run: + if(self.env is not None): + kwargs['env'] = self.env + job_id = self.job_manager.submit( command_line = cmd, name = name, -- GitLab