示例#1
0
 def test_runs_in_job_directory_when_specified(self):
     self._set_up_deploy_config()
     self.mock_arguments.job_directory = self.job_directory
     submit(self.mock_arguments)
     self.mock_os_chdir.assert_has_calls(
         [call(self.job_directory),
          call(self.current_directory)])
示例#2
0
 def test_sets_override_worker_container_config_with_docker_command_provided(
         self):
     self._set_up_deploy_config()
     command = self.faker.words()
     self.mock_arguments.command = command
     self.mock_os_path_exists.return_when(True, command[0])
     submit(self.mock_arguments)
     self.assertEqual({'args': command},
                      self.config_manager['worker_container_overrides'])
def submit(**kwargs):
    from foundations_core_cli.job_submission.submit_job import submit
    from foundations_contrib.global_state import push_state, pop_state

    arguments = _deployment_arguments(**kwargs)
    try:
        push_state()
        return submit(arguments)
    finally:
        pop_state()
示例#4
0
 def test_sets_specified_resources_from_job_config(self):
     self._set_up_job_config()
     submit(self.mock_arguments)
     self.mock_set_resources.assert_called_with(
         num_gpus=self.job_config['num_gpus'], ram=self.job_config['ram'])
示例#5
0
 def test_sets_specified_memory_resources(self):
     self.mock_arguments.ram = self.ram
     self._set_up_deploy_config()
     submit(self.mock_arguments)
     self.mock_set_resources.assert_called_with(ram=self.ram)
示例#6
0
 def test_sets_specified_gpu_resources(self):
     self.mock_arguments.num_gpus = self.num_gpus
     self._set_up_deploy_config()
     submit(self.mock_arguments)
     self.mock_set_resources.assert_called_with(num_gpus=self.num_gpus)
示例#7
0
 def test_sets_default_job_resources(self):
     self._set_up_deploy_config()
     submit(self.mock_arguments)
     self.mock_set_resources.assert_called_with()
示例#8
0
 def test_streams_log_from_deployment_using_override_config(self):
     self._set_up_job_config()
     submit(self.mock_arguments)
     self.mock_stream_logs.assert_called_with(self.mock_deployment)
示例#9
0
 def test_loads_specific_scheduler_config(self):
     self._set_up_deploy_config()
     self.mock_arguments.scheduler_config = self.scheduler_config
     submit(self.mock_arguments)
     self.mock_load_config.assert_called_with(self.scheduler_config)
示例#10
0
 def test_sets_override_log_level_from_job_config(self):
     self._set_up_job_config()
     submit(self.mock_arguments)
     self.assertEqual(self.job_config['log_level'],
                      self.config_manager['log_level'])
示例#11
0
 def test_does_not_break_when_interrupt_happens(self):
     self._set_up_deploy_config()
     self.mock_stream_logs.side_effect = self._send_interrupt
     with self.assert_does_not_raise():
         submit(self.mock_arguments)
示例#12
0
 def test_returns_deployment(self):
     self._set_up_deploy_config()
     self.assertEqual(self.mock_deployment, submit(self.mock_arguments))
示例#13
0
 def test_does_not_stream_logs_if_disabled(self):
     self._set_up_deploy_config()
     self.mock_arguments.stream_job_logs = False
     submit(self.mock_arguments)
     self.mock_stream_logs.assert_not_called()
示例#14
0
 def test_streams_log_from_created_deployment(self):
     self._set_up_deploy_config()
     submit(self.mock_arguments)
     self.mock_stream_logs.assert_called_with(self.mock_deployment)
示例#15
0
    def _submit(self):
        from foundations_core_cli.job_submission.submit_job import submit

        submit(self._cli.arguments())
示例#16
0
 def test_sets_override_worker_container_config(self):
     self._set_up_job_config()
     submit(self.mock_arguments)
     self.assertEqual(self.job_config['worker'],
                      self.config_manager['worker_container_overrides'])
示例#17
0
 def test_loads_default_scheduler_config(self):
     self._set_up_deploy_config()
     submit(self.mock_arguments)
     self.mock_load_config.assert_called_with('scheduler')