def delete_job(self, workflow, job): """Delete config for a given job. Args: workflow: The workflow name where the job is defined. job: The name of the job whose config should be deleted. """ path = Path(workflow=workflow, job=job) self._delete_config(path.get_job_path())
def put_job(self, job_config): """Add or replace a job. Args: job_config: The job config to add or replace. """ path = Path(workflow=job_config.workflow, job=job_config.job) job_config_json = Repository._json_pretty_print(job_config.format()) self._put_config(path.get_job_path(), job_config_json)
def get_job(self, workflow, job): """Retrieve config for a given job. Args: workflow: The workflow name where the job is defined. job: The name of the job whose config should be retrieved. Returns: The job config. """ path = Path(workflow=workflow, job=job) job_json = self._get_config(path.get_job_path()) return JobConfig.from_json(job_json)
def test_job_path(self): path = Path(workflow='some_workflow', job='some_job') self.assertEqual('/workflow/some_workflow/job/some_job', path.get_job_path())