Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Make Cancel and Delete job/job run methods more transparent. #755

Open
tanyakoganoracle opened this issue Apr 5, 2024 · 0 comments
Labels
ack acknowledged enhancement New feature or request

Comments

@tanyakoganoracle
Copy link
Member

Willingness to contribute

Yes. I can contribute this feature independently.

Proposal Summary

Make Cancel and Delete methods more transparent.
In case of deleting a job or job run, the process should be smooth, no throwing of errors on "cancel first" or can not "delete already deleted".

Maybe just to add force_delete method instead of modifying the existing.

This is our code to avoid this behavior:

def delete_runs(self, delete_all_job_runs: bool = False) -> None:
    if delete_all_job_runs:
        job_runs = self._oci_instance.run_list()
    else:
        job_runs = self.list_runs_in_progress()
    for job_run in job_runs:
        job_run.sync()
        if job_run.lifecycle_state in CANCELLABLE_STATES:
            logger.debug(f"Canceling job: {job_run.name} {job_run.status}")
            job_run.cancel()
            job_run.sync()
        while job_run.lifecycle_state == JobRun.LIFECYCLE_STATE_CANCELING:
            time.sleep(1)
            job_run.sync()
        if job_run.lifecycle_state in DELETABLE_STATES:
            logger.debug(f"Deleting job: {job_run.name} {job_run.status}")
            job_run.delete()  # TODO: make this in thread and open a task for ADS team

Motivation

This is nice to have to fully support SOLID principal

Details

No response

@mrDzurb mrDzurb added enhancement New feature or request ack acknowledged labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack acknowledged enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants