Exemple #1
0
    def test_slurm_command_priority(self):
        run = ContainerRun(pk=99)
        run.user = User(username='******')
        run.app = ContainerApp()
        run.app.container = Container()
        run.app.container.family = ContainerFamily(name='my container')
        slurm_queues = (('low', 'kive-low'),
                        ('medium', 'kive-medium'),
                        ('high', 'kive-high'))
        run.priority = 2
        run.sandbox_path = 'run23'
        expected_command = [
            'sbatch',
            '-J', 'r99 my container',
            '--parsable',
            '--output', '/tmp/kive_media/run23/logs/job%J_node%N_stdout.txt',
            '--error', '/tmp/kive_media/run23/logs/job%J_node%N_stderr.txt',
            '-c', '1',
            '--mem', '6000',
            '-p', 'kive-high',
            EXPECTED_MANAGE_PATH,
            'runcontainer',
            '99']

        command = run.build_slurm_command(slurm_queues)

        self.assertListEqual(expected_command, command)
Exemple #2
0
    def test_slurm_command_custom_memory(self):
        run = ContainerRun(pk=99)
        run.user = User(username='******')
        run.app = ContainerApp(threads=3, memory=100)
        run.app.container = Container()
        run.app.container.family = ContainerFamily(name='my container')
        run.sandbox_path = 'run23'
        expected_command = [
            'sbatch', '-J', 'r99 my container', '--parsable', '--output',
            '/tmp/kive_media/run23/logs/job%J_node%N_stdout.txt', '--error',
            '/tmp/kive_media/run23/logs/job%J_node%N_stderr.txt', '-c', '3',
            '--mem', '100', EXPECTED_MANAGE_PATH, 'runcontainer', '99'
        ]

        command = run.build_slurm_command()

        self.assertListEqual(expected_command, command)
Exemple #3
0
    def test_slurm_command_priority(self):
        run = ContainerRun(pk=99)
        run.user = User(username='******')
        run.app = ContainerApp()
        run.app.container = Container()
        run.app.container.family = ContainerFamily(name='my container')
        slurm_queues = (('low', 'kive-low'), ('medium', 'kive-medium'),
                        ('high', 'kive-high'))
        run.priority = 2
        run.sandbox_path = 'run23'
        expected_command = [
            'sbatch', '-J', 'r99 my container', '--parsable', '--output',
            '/tmp/kive_media/run23/logs/job%J_node%N_stdout.txt', '--error',
            '/tmp/kive_media/run23/logs/job%J_node%N_stderr.txt', '-c', '1',
            '--mem', '6000', '-p', 'kive-high', EXPECTED_MANAGE_PATH,
            'runcontainer', '99'
        ]

        command = run.build_slurm_command(slurm_queues)

        self.assertListEqual(expected_command, command)
Exemple #4
0
    def test_slurm_command_custom_memory(self):
        run = ContainerRun(pk=99)
        run.user = User(username='******')
        run.app = ContainerApp(threads=3, memory=100)
        run.app.container = Container()
        run.app.container.family = ContainerFamily(name='my container')
        run.sandbox_path = 'run23'
        expected_command = [
            'sbatch',
            '-J', 'r99 my container',
            '--parsable',
            '--output', '/tmp/kive_media/run23/logs/job%J_node%N_stdout.txt',
            '--error', '/tmp/kive_media/run23/logs/job%J_node%N_stderr.txt',
            '-c', '3',
            '--mem', '100',
            EXPECTED_MANAGE_PATH,
            'runcontainer',
            '99']

        command = run.build_slurm_command()

        self.assertListEqual(expected_command, command)