def _do_update(job: JobDto) -> JobDto: existing_row = JobDao.find_job_by_uuid(job.uuid) updated_row = JobDto( id=existing_row.id, uuid=existing_row.uuid, name=job.name if job.name is not None else existing_row.name, url=job.url if job.url is not None else existing_row.url ) with sql_commit(JobDao._UPDATE_JOB, updated_row.parameterize()) as last_row_id: LOGGER.debug(f"Updated existing job with id: {existing_row.id}") return updated_row
def _do_update(run: RunDto) -> RunDto: existing_row = RunDao.find_by_uuid(run.uuid) updated_row = RunDto(id=existing_row.id, job_id=run.job_id, uuid=existing_row.uuid, status=run.status, started=run.started, ended=run.ended) with sql_commit(RunDao._UPDATE_RUN, updated_row.parameterize()) as last_row_id: LOGGER.debug(f"Updated existing run with id: {existing_row.id}") return updated_row
def _do_update(step: StepDto) -> StepDto: existing_row = StepDao.find_by_run_id_and_number( step.run_id, step.number) updated_row = StepDto(id=existing_row.id, run_id=step.run_id, number=step.number, name=step.name, image=step.image, status=step.status) with sql_commit(StepDao._UPDATE_STEP, updated_row.parameterize()) as last_row_id: LOGGER.debug(f"Updated existing run with id: {existing_row.id}") return updated_row
def _do_update(command: CommandDto) -> CommandDto: existing_row = CommandDao.find_by_step_id_and_number( command.step_id, command.number) updated_row = CommandDto(id=existing_row.id, step_id=command.step_id, number=command.number, instruction=command.instruction, std_out=command.std_out, std_err=command.std_err) with sql_commit(CommandDao._UPDATE_COMMAND, updated_row.parameterize()) as last_row_id: LOGGER.debug( f"Updated existing command with id: {existing_row.id}") return updated_row
def _do_insert(command: CommandDto) -> CommandDto: with sql_commit(CommandDao._INSERT_COMMAND, command.parameterize()) as last_row_id: LOGGER.debug(f"Added command with id: {last_row_id}") return CommandDao.find_by_id(last_row_id)
def _do_insert(step: StepDto) -> StepDto: with sql_commit(StepDao._INSERT_STEP, step.parameterize()) as last_row_id: LOGGER.debug(f"Added step with id: {last_row_id}") return StepDao.find_by_id(last_row_id)
def _do_insert(job: JobDto) -> JobDto: with sql_commit(JobDao._INSERT_JOB, job.parameterize()) as last_row_id: if last_row_id > 0: LOGGER.debug(f"Added or replaced job with id: {last_row_id}") return JobDao.find_job_by_id(last_row_id)
def delete(job: JobDto) -> None: with sql_commit(JobDao._DELETE_JOB, [job.id]): LOGGER.debug(f"Removed Job with id: {job.id}")
def _do_insert(job: RunDto) -> RunDto: with sql_commit(RunDao._INSERT_RUN, job.parameterize()) as last_row_id: LOGGER.debug(f"Added run with id: {last_row_id}") return RunDao.find_by_id(last_row_id)
def delete(run: RunDto) -> None: with sql_commit(RunDao._DELETE_RUN, [run.id]): LOGGER.debug(f"Removed Run with id: {run.id}")