Example #1
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     self.user2 = UserFactory()
     self.project = ProjectFactory()
     op_spec = OperationSpecification.read(values=get_fxt_job_with_inputs())
     self.run = compile_operation_run(project_id=self.project.id,
                                      op_spec=op_spec,
                                      user_id=self.user.id)
Example #2
0
 def test_create_run_with_templated_job_spec(self):
     config_dict = get_fxt_job_with_inputs()
     spec = OperationSpecification.read(values=config_dict)
     run = compile_operation_run(project_id=self.project.id,
                                 user_id=self.user.id,
                                 op_spec=spec)
     assert run.kind == V1RunKind.JOB
     assert run.name == "foo"
     assert run.description == "a description"
     assert set(run.tags) == {"tag1", "tag2"}  # From template
     compiled_operation = CompiledOperationSpecification.read(run.content)
     compiled_operation = CompiledOperationSpecification.apply_params(
         compiled_operation, params=spec.params)
     compiled_operation = CompiledOperationSpecification.apply_context(
         compiled_operation)
     CompiledOperationSpecification.apply_run_contexts(compiled_operation, )
     run.content = compiled_operation.to_dict(dump=True)
     run.save(update_fields=["content"])
     job_spec = CompiledOperationSpecification.read(run.content)
     assert job_spec.run.container.image == "{{ image }}"
     job_spec = CompiledOperationSpecification.apply_run_contexts(job_spec)
     assert job_spec.run.container.image == "foo/bar"