From da6feb9f76895ec0fa6f4b310ebb23aa92b38f66 Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Tue, 24 Jan 2017 03:24:59 -0500 Subject: [PATCH 1/9] Initial version of memory support --- scripts/smart-dispatch | 9 ++++----- smartdispatch/job_generator.py | 16 ++++++++++++++-- smartdispatch/queue.py | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/smart-dispatch b/scripts/smart-dispatch index 86904fa..807aae5 100755 --- a/scripts/smart-dispatch +++ b/scripts/smart-dispatch @@ -146,8 +146,7 @@ def main(): log_folder=path_job_logs, worker_call_suffix=worker_call_suffix) commands = [COMMAND_STRING.format(ID=i) for i in range(args.pool)] - # TODO: use args.memPerNode instead of args.memPerNode - queue = Queue(args.queueName, CLUSTER_NAME, args.walltime, args.coresPerNode, args.gpusPerNode, float('inf'), args.modules) + queue = Queue(args.queueName, CLUSTER_NAME, args.walltime, args.coresPerNode, args.gpusPerNode, args.memPerNode, args.modules) # Check that requested core number does not exceed node total if args.coresPerCommand > queue.nb_cores_per_node: @@ -172,7 +171,7 @@ def main(): for pbs_id, pbs in enumerate(job_generator.pbs_list): proper_size_name = utils.jobname_generator(jobname, pbs_id) pbs.add_options(N=proper_size_name) - + if args.pbsFlags is not None: job_generator.add_pbs_flags(args.pbsFlags.split(' ')) pbs_filenames = job_generator.write_pbs_files(path_job_commands) @@ -193,11 +192,11 @@ def parse_arguments(): parser.add_argument('-L', '--launcher', choices=['qsub', 'msub'], required=False, help='Which launcher to use. Default: qsub') parser.add_argument('-C', '--coresPerNode', type=int, required=False, help='How many cores there are per node.') parser.add_argument('-G', '--gpusPerNode', type=int, required=False, help='How many gpus there are per node.') - # parser.add_argument('-M', '--memPerNode', type=int, required=False, help='How much memory there are per node (in Gb).') + parser.add_argument('-M', '--memPerNode', type=int, required=False, help='How much memory there are per node (in Gb).') parser.add_argument('-c', '--coresPerCommand', type=int, required=False, help='How many cores a command needs.', default=1) parser.add_argument('-g', '--gpusPerCommand', type=int, required=False, help='How many gpus a command needs.', default=1) - # parser.add_argument('-m', '--memPerCommand', type=float, required=False, help='How much memory a command needs (in Gb).') + parser.add_argument('-m', '--memPerCommand', type=float, required=False, help='How much memory a command needs (in Gb).') parser.add_argument('-f', '--commandsFile', type=file, required=False, help='File containing commands to launch. Each command must be on a seperate line. (Replaces commandAndOptions)') parser.add_argument('-l', '--modules', type=str, required=False, help='List of additional modules to load.', nargs='+') diff --git a/smartdispatch/job_generator.py b/smartdispatch/job_generator.py index d2db23c..842d459 100644 --- a/smartdispatch/job_generator.py +++ b/smartdispatch/job_generator.py @@ -46,7 +46,7 @@ def __init__(self, queue, commands, prolog=[], epilog=[], command_params={}, bas self.nb_cores_per_command = command_params.get('nb_cores_per_command', 1) self.nb_gpus_per_command = command_params.get('nb_gpus_per_command', 1) - #self.mem_per_command = command_params.get('mem_per_command', 0.0) + self.mem_per_command = command_params.get('mem_per_command', None) self.pbs_list = self._generate_base_pbs() self._add_cluster_specific_rules() @@ -80,6 +80,15 @@ def _generate_base_pbs(self): if self.queue.nb_gpus_per_node > 0 and self.nb_gpus_per_command > 0: nb_commands_per_node = min(nb_commands_per_node, self.queue.nb_gpus_per_node // self.nb_gpus_per_command) + # Limit number of running commands by the amount of available memory on the node. + if self.mem_per_command is not None: + nb_commands_per_node = min(nb_commands_per_node, self.queue.mem_per_node // self.mem_per_command) + mem_per_command = self.mem_per_command + elif self.queue.mem_per_node < float('inf'): + mem_per_command = self.queue.mem_per_node // nb_commands_per_node + else: + mem_per_command = None + pbs_files = [] # Distribute equally the jobs among the PBS files and generate those files for i, commands in enumerate(utils.chunks(self.commands, n=nb_commands_per_node)): @@ -92,9 +101,12 @@ def _generate_base_pbs(self): resource = "1:ppn={ppn}".format(ppn=len(commands) * self.nb_cores_per_command) if self.queue.nb_gpus_per_node > 0: resource += ":gpus={gpus}".format(gpus=len(commands) * self.nb_gpus_per_command) - pbs.add_resources(nodes=resource) + if mem_per_command is not None: + resource = "{mem}Gb".format(mem=len(commands) * mem_per_command) + pbs.add_resources(mem=resource) + pbs.add_modules_to_load(*self.queue.modules) pbs.add_to_prolog(*self.prolog) pbs.add_commands(*commands) diff --git a/smartdispatch/queue.py b/smartdispatch/queue.py index 091fa8d..bd5b96d 100644 --- a/smartdispatch/queue.py +++ b/smartdispatch/queue.py @@ -9,7 +9,7 @@ def __init__(self, name, cluster_name, walltime=None, nb_cores_per_node=None, nb self.walltime = walltime self.nb_cores_per_node = nb_cores_per_node self.nb_gpus_per_node = nb_gpus_per_node - self.mem_per_node = mem_per_node + self.mem_per_node = mem_per_node if mem_per_node is not None else float('inf') self.modules = modules if modules is not None else [] available_queues = get_available_queues(self.cluster_name) @@ -38,5 +38,5 @@ def __init__(self, name, cluster_name, walltime=None, nb_cores_per_node=None, nb if self.nb_gpus_per_node is None: self.nb_gpus_per_node = 0 # Means, there are no gpus on those queue nodes - if self.mem_per_node is None or self.mem_per_node <= 0: + if self.mem_per_node <= 0: raise ValueError("Queues must have at least some memory!") From 87771cf252e8aae25ba5affab496d772aa985585 Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Sat, 28 Jan 2017 01:05:31 -0500 Subject: [PATCH 2/9] Bugfixes --- scripts/smart-dispatch | 2 +- smartdispatch/job_generator.py | 4 +--- smartdispatch/queue.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/smart-dispatch b/scripts/smart-dispatch index 807aae5..55dd11a 100755 --- a/scripts/smart-dispatch +++ b/scripts/smart-dispatch @@ -192,7 +192,7 @@ def parse_arguments(): parser.add_argument('-L', '--launcher', choices=['qsub', 'msub'], required=False, help='Which launcher to use. Default: qsub') parser.add_argument('-C', '--coresPerNode', type=int, required=False, help='How many cores there are per node.') parser.add_argument('-G', '--gpusPerNode', type=int, required=False, help='How many gpus there are per node.') - parser.add_argument('-M', '--memPerNode', type=int, required=False, help='How much memory there are per node (in Gb).') + parser.add_argument('-M', '--memPerNode', type=float, required=False, help='How much memory there are per node (in Gb).') parser.add_argument('-c', '--coresPerCommand', type=int, required=False, help='How many cores a command needs.', default=1) parser.add_argument('-g', '--gpusPerCommand', type=int, required=False, help='How many gpus a command needs.', default=1) diff --git a/smartdispatch/job_generator.py b/smartdispatch/job_generator.py index 842d459..ade1662 100644 --- a/smartdispatch/job_generator.py +++ b/smartdispatch/job_generator.py @@ -84,10 +84,8 @@ def _generate_base_pbs(self): if self.mem_per_command is not None: nb_commands_per_node = min(nb_commands_per_node, self.queue.mem_per_node // self.mem_per_command) mem_per_command = self.mem_per_command - elif self.queue.mem_per_node < float('inf'): - mem_per_command = self.queue.mem_per_node // nb_commands_per_node else: - mem_per_command = None + mem_per_command = self.queue.mem_per_node // nb_commands_per_node pbs_files = [] # Distribute equally the jobs among the PBS files and generate those files diff --git a/smartdispatch/queue.py b/smartdispatch/queue.py index bd5b96d..091fa8d 100644 --- a/smartdispatch/queue.py +++ b/smartdispatch/queue.py @@ -9,7 +9,7 @@ def __init__(self, name, cluster_name, walltime=None, nb_cores_per_node=None, nb self.walltime = walltime self.nb_cores_per_node = nb_cores_per_node self.nb_gpus_per_node = nb_gpus_per_node - self.mem_per_node = mem_per_node if mem_per_node is not None else float('inf') + self.mem_per_node = mem_per_node self.modules = modules if modules is not None else [] available_queues = get_available_queues(self.cluster_name) @@ -38,5 +38,5 @@ def __init__(self, name, cluster_name, walltime=None, nb_cores_per_node=None, nb if self.nb_gpus_per_node is None: self.nb_gpus_per_node = 0 # Means, there are no gpus on those queue nodes - if self.mem_per_node <= 0: + if self.mem_per_node is None or self.mem_per_node <= 0: raise ValueError("Queues must have at least some memory!") From 821ca371f13961adc36684c71491090c3872d815 Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Sat, 28 Jan 2017 02:03:43 -0500 Subject: [PATCH 3/9] Fixed tests --- tests/test_smart_dispatch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_smart_dispatch.py b/tests/test_smart_dispatch.py index 9e514c1..14e2176 100644 --- a/tests/test_smart_dispatch.py +++ b/tests/test_smart_dispatch.py @@ -23,15 +23,15 @@ def setUp(self): self.nb_commands = len(self.commands) scripts_path = abspath(pjoin(os.path.dirname(__file__), os.pardir, "scripts")) - self.smart_dispatch_command = '{} -C 1 -q test -t 5:00 -x'.format(pjoin(scripts_path, 'smart-dispatch')) + self.smart_dispatch_command = '{} -C 1 -M 1 -q test -t 5:00 -x'.format(pjoin(scripts_path, 'smart-dispatch')) self.launch_command = "{0} launch {1}".format(self.smart_dispatch_command, self.folded_commands) self.resume_command = "{0} resume {{0}}".format(self.smart_dispatch_command) - smart_dispatch_command_with_pool = '{} --pool 10 -C 1 -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) + smart_dispatch_command_with_pool = '{} --pool 10 -C 1 -M 1 -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) self.launch_command_with_pool = smart_dispatch_command_with_pool.format('launch ' + self.folded_commands) self.nb_workers = 10 - smart_dispatch_command_with_cores = '{} -C 1 -c {{cores}} -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) + smart_dispatch_command_with_cores = '{} -C 1 -M 1 -c {{cores}} -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) self.launch_command_with_cores = smart_dispatch_command_with_cores.format('launch ' + self.folded_commands, cores='{cores}') self._cwd = os.getcwd() From ffc8ce5bf1ad67bfb76a79b8c03c9e04c251165c Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Sat, 28 Jan 2017 02:28:51 -0500 Subject: [PATCH 4/9] Bug fixes --- scripts/smart-dispatch | 11 +++++++++-- tests/test_smart_dispatch.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/scripts/smart-dispatch b/scripts/smart-dispatch index 55dd11a..ea4fab4 100755 --- a/scripts/smart-dispatch +++ b/scripts/smart-dispatch @@ -148,12 +148,17 @@ def main(): queue = Queue(args.queueName, CLUSTER_NAME, args.walltime, args.coresPerNode, args.gpusPerNode, args.memPerNode, args.modules) - # Check that requested core number does not exceed node total + # Check that requested per command resources do not exceed node total if args.coresPerCommand > queue.nb_cores_per_node: sys.stderr.write("smart-dispatch: error: coresPerCommand exceeds nodes total: asked {req_cores} cores, nodes have {node_cores}\n" .format(req_cores=args.coresPerCommand, node_cores=queue.nb_cores_per_node)) sys.exit(2) + if args.memPerCommand > queue.mem_per_node: + sys.stderr.write("smart-dispatch: error: memPerCommand exceeds nodes total: asked {req_mem} Gb, nodes have {node_mem} Gb\n" + .format(req_mem=args.memPerCommand, node_mem=queue.mem_per_node)) + sys.exit(2) + command_params = {'nb_cores_per_command': args.coresPerCommand, 'nb_gpus_per_command': args.gpusPerCommand, 'mem_per_command': None # args.memPerCommand @@ -223,7 +228,9 @@ def parse_arguments(): if args.queueName not in AVAILABLE_QUEUES and ((args.coresPerNode is None and args.gpusPerNode is None) or args.walltime is None): parser.error("Unknown queue, --coresPerNode/--gpusPerNode and --walltime must be set.") if args.coresPerCommand < 1: - parser.error("coresPerNode must be at least 1") + parser.error("coresPerCommand must be at least 1") + if args.memPerCommand is not None and args.memPerCommand < 0: + parser.error("memPerCommand must be positive") return args diff --git a/tests/test_smart_dispatch.py b/tests/test_smart_dispatch.py index 14e2176..23dad2d 100644 --- a/tests/test_smart_dispatch.py +++ b/tests/test_smart_dispatch.py @@ -34,6 +34,9 @@ def setUp(self): smart_dispatch_command_with_cores = '{} -C 1 -M 1 -c {{cores}} -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) self.launch_command_with_cores = smart_dispatch_command_with_cores.format('launch ' + self.folded_commands, cores='{cores}') + smart_dispatch_command_with_memory = '{} -C 1 -M 1 -m {{memory}} -q test -t 5:00 -x {{0}}'.format(pjoin(scripts_path, 'smart-dispatch')) + self.launch_command_with_memory = smart_dispatch_command_with_memory.format('launch ' + self.folded_commands, memory='{memory}') + self._cwd = os.getcwd() os.chdir(self.testing_dir) @@ -95,6 +98,18 @@ def test_main_launch_with_cores_command(self): assert_equal(exit_status_100, 2) assert_true(os.path.isdir(self.logs_dir)) + def test_main_launch_with_memory_command(self): + # Actual test + exit_status_0 = call(self.launch_command_with_memory.format(memory=0), shell=True) + exit_status_05 = call(self.launch_command_with_memory.format(memory=0.5), shell=True) + exit_status_100 = call(self.launch_command_with_memory.format(memory=100), shell=True) + + # Test validation + assert_equal(exit_status_0, 2) + assert_equal(exit_status_05, 0) + assert_equal(exit_status_100, 2) + assert_true(os.path.isdir(self.logs_dir)) + def test_main_resume(self): # Setup call(self.launch_command, shell=True) From 1779a4f9f03a7b9313acf6291d9563ca9230864a Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Sat, 28 Jan 2017 02:34:34 -0500 Subject: [PATCH 5/9] Minor test fix --- scripts/smart-dispatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/smart-dispatch b/scripts/smart-dispatch index ea4fab4..58d796d 100755 --- a/scripts/smart-dispatch +++ b/scripts/smart-dispatch @@ -229,7 +229,7 @@ def parse_arguments(): parser.error("Unknown queue, --coresPerNode/--gpusPerNode and --walltime must be set.") if args.coresPerCommand < 1: parser.error("coresPerCommand must be at least 1") - if args.memPerCommand is not None and args.memPerCommand < 0: + if args.memPerCommand is not None and args.memPerCommand <= 0: parser.error("memPerCommand must be positive") return args From dfa1391c9516b00a62780fba7f6c992411318b01 Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Sat, 28 Jan 2017 02:50:15 -0500 Subject: [PATCH 6/9] Additional tests for JobGenerator --- smartdispatch/tests/test_job_generator.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/smartdispatch/tests/test_job_generator.py b/smartdispatch/tests/test_job_generator.py index 7214d9d..9afccac 100644 --- a/smartdispatch/tests/test_job_generator.py +++ b/smartdispatch/tests/test_job_generator.py @@ -64,6 +64,28 @@ def test_generate_pbs4_cpu(self): # Check if needed modules for this queue are included in the PBS file assert_equal(job_generator.pbs_list[0].modules, self.modules) + def test_generate_pbs2_mem(self): + # Should need two PBS file + command_params = {'mem_per_command': self.mem_per_node // 2} + job_generator = JobGenerator(self.queue, self.commands, command_params) + assert_equal(len(job_generator.pbs_list), 2) + assert_equal(job_generator.pbs_list[0].commands, self.commands[:2]) + assert_equal(job_generator.pbs_list[1].commands, self.commands[2:]) + + def test_generate_pbs4_mem(self): + # Should needs four PBS file + command_params = {'mem_per_command': self.mem_per_node} + job_generator = JobGenerator(self.queue, self.commands, command_params) + assert_equal(len(job_generator.pbs_list), 4) + assert_equal([pbs.commands[0] for pbs in job_generator.pbs_list], self.commands) + + # Since queue has no gpus it should not be specified in PBS resource `nodes` + assert_true('gpus' not in job_generator.pbs_list[0].resources['nodes']) + + # Test modules to load + # Check if needed modules for this queue are included in the PBS file + assert_equal(job_generator.pbs_list[0].modules, self.modules) + def test_generate_pbs2_gpu(self): # Test nb_gpus_per_command argument # Should needs two PBS file From 8446e5e7b2888b6a881497cc5c537131990676b8 Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Fri, 10 Feb 2017 16:56:27 -0500 Subject: [PATCH 7/9] Small fixes --- smartdispatch/job_generator.py | 5 ++--- smartdispatch/tests/test_job_generator.py | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/smartdispatch/job_generator.py b/smartdispatch/job_generator.py index ade1662..ea2a7e0 100644 --- a/smartdispatch/job_generator.py +++ b/smartdispatch/job_generator.py @@ -101,9 +101,8 @@ def _generate_base_pbs(self): resource += ":gpus={gpus}".format(gpus=len(commands) * self.nb_gpus_per_command) pbs.add_resources(nodes=resource) - if mem_per_command is not None: - resource = "{mem}Gb".format(mem=len(commands) * mem_per_command) - pbs.add_resources(mem=resource) + resource = "{mem}Gb".format(mem=len(commands) * mem_per_command) + pbs.add_resources(mem=resource) pbs.add_modules_to_load(*self.queue.modules) pbs.add_to_prolog(*self.prolog) diff --git a/smartdispatch/tests/test_job_generator.py b/smartdispatch/tests/test_job_generator.py index 9afccac..2b47b2a 100644 --- a/smartdispatch/tests/test_job_generator.py +++ b/smartdispatch/tests/test_job_generator.py @@ -43,7 +43,7 @@ def test_generate_pbs(self): assert_equal(job_generator.pbs_list[0].epilog, self.epilog) def test_generate_pbs2_cpu(self): - # Should needs two PBS file + # Should need two PBS files command_params = {'nb_cores_per_command': self.cores // 2} job_generator = JobGenerator(self.queue, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 2) @@ -51,7 +51,7 @@ def test_generate_pbs2_cpu(self): assert_equal(job_generator.pbs_list[1].commands, self.commands[2:]) def test_generate_pbs4_cpu(self): - # Should needs four PBS file + # Should need four PBS files command_params = {'nb_cores_per_command': self.cores} job_generator = JobGenerator(self.queue, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 4) @@ -65,7 +65,7 @@ def test_generate_pbs4_cpu(self): assert_equal(job_generator.pbs_list[0].modules, self.modules) def test_generate_pbs2_mem(self): - # Should need two PBS file + # Should need two PBS files command_params = {'mem_per_command': self.mem_per_node // 2} job_generator = JobGenerator(self.queue, self.commands, command_params) assert_equal(len(job_generator.pbs_list), 2) @@ -73,7 +73,7 @@ def test_generate_pbs2_mem(self): assert_equal(job_generator.pbs_list[1].commands, self.commands[2:]) def test_generate_pbs4_mem(self): - # Should needs four PBS file + # Should need four PBS files command_params = {'mem_per_command': self.mem_per_node} job_generator = JobGenerator(self.queue, self.commands, command_params) assert_equal(len(job_generator.pbs_list), 4) @@ -88,7 +88,7 @@ def test_generate_pbs4_mem(self): def test_generate_pbs2_gpu(self): # Test nb_gpus_per_command argument - # Should needs two PBS file + # Should need two PBS files command_params = {'nb_gpus_per_command': self.gpus // 2} job_generator = JobGenerator(self.queue_gpu, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 2) @@ -96,7 +96,7 @@ def test_generate_pbs2_gpu(self): assert_equal(job_generator.pbs_list[1].commands, self.commands[2:]) def test_generate_pbs4_gpu(self): - # Should needs four PBS files + # Should need four PBS files command_params = {'nb_gpus_per_command': self.gpus} job_generator = JobGenerator(self.queue_gpu, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 4) From 3b193ff097da70ad091d2ff8341082a662bdc53e Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Fri, 10 Feb 2017 18:35:01 -0500 Subject: [PATCH 8/9] Mem per command was never used - fixed --- scripts/smart-dispatch | 2 +- smartdispatch/job_generator.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/smart-dispatch b/scripts/smart-dispatch index 58d796d..69d243e 100755 --- a/scripts/smart-dispatch +++ b/scripts/smart-dispatch @@ -161,7 +161,7 @@ def main(): command_params = {'nb_cores_per_command': args.coresPerCommand, 'nb_gpus_per_command': args.gpusPerCommand, - 'mem_per_command': None # args.memPerCommand + 'mem_per_command': args.memPerCommand } prolog = [] diff --git a/smartdispatch/job_generator.py b/smartdispatch/job_generator.py index ea2a7e0..743a54d 100644 --- a/smartdispatch/job_generator.py +++ b/smartdispatch/job_generator.py @@ -83,9 +83,6 @@ def _generate_base_pbs(self): # Limit number of running commands by the amount of available memory on the node. if self.mem_per_command is not None: nb_commands_per_node = min(nb_commands_per_node, self.queue.mem_per_node // self.mem_per_command) - mem_per_command = self.mem_per_command - else: - mem_per_command = self.queue.mem_per_node // nb_commands_per_node pbs_files = [] # Distribute equally the jobs among the PBS files and generate those files @@ -101,8 +98,9 @@ def _generate_base_pbs(self): resource += ":gpus={gpus}".format(gpus=len(commands) * self.nb_gpus_per_command) pbs.add_resources(nodes=resource) - resource = "{mem}Gb".format(mem=len(commands) * mem_per_command) - pbs.add_resources(mem=resource) + if self.mem_per_command is not None: + resource = "{mem}Gb".format(mem=len(commands) * self.mem_per_command) + pbs.add_resources(mem=resource) pbs.add_modules_to_load(*self.queue.modules) pbs.add_to_prolog(*self.prolog) From 110beed20fb931d9f955e0cd260bf0562bdc1d3e Mon Sep 17 00:00:00 2001 From: Yaroslav Ganin Date: Fri, 17 Feb 2017 15:14:17 -0500 Subject: [PATCH 9/9] Fixed tests to respect the newest JobGenerator interface --- smartdispatch/tests/test_job_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smartdispatch/tests/test_job_generator.py b/smartdispatch/tests/test_job_generator.py index 2b47b2a..b60a5a5 100644 --- a/smartdispatch/tests/test_job_generator.py +++ b/smartdispatch/tests/test_job_generator.py @@ -67,7 +67,7 @@ def test_generate_pbs4_cpu(self): def test_generate_pbs2_mem(self): # Should need two PBS files command_params = {'mem_per_command': self.mem_per_node // 2} - job_generator = JobGenerator(self.queue, self.commands, command_params) + job_generator = JobGenerator(self.queue, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 2) assert_equal(job_generator.pbs_list[0].commands, self.commands[:2]) assert_equal(job_generator.pbs_list[1].commands, self.commands[2:]) @@ -75,7 +75,7 @@ def test_generate_pbs2_mem(self): def test_generate_pbs4_mem(self): # Should need four PBS files command_params = {'mem_per_command': self.mem_per_node} - job_generator = JobGenerator(self.queue, self.commands, command_params) + job_generator = JobGenerator(self.queue, self.commands, command_params=command_params) assert_equal(len(job_generator.pbs_list), 4) assert_equal([pbs.commands[0] for pbs in job_generator.pbs_list], self.commands)