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

Python example of how to delete/stop kueue jobs that are queues or in progress #3875

Open
joshwhieb opened this issue Dec 17, 2024 · 0 comments

Comments

@joshwhieb
Copy link

joshwhieb commented Dec 17, 2024

In the kubernetes python examples there is submission of jobs but nothing on stopping/deleting jobs that are queued or in progress. I can use the batchV1API instance in python and it works for jobs in progress but can't quite figure out how I stop jobs that are queued in kueue. I believe the jobs are submitted to kueue as workloads but is there an API to delete workloads?

https://kueue.sigs.k8s.io/docs/tasks/run/python_jobs/

    namespace = 'default'
    group_id = 'f4336081-0079-4403-b9f4-55b4f4cda948'
    config = create_kubernetes_config(server, token, cert, key)
    batch_api_inst = kubernetes.client.BatchV1Api(kubernetes.client.ApiClient(configuration=config))
    ret = batch_api_inst.list_namespaced_job(
            namespace,
            label_selector=f"group_id={group_id}"
    )
    for j in ret.items:
         batch_api_inst.delete_namespaced_job(j.metadata.name, namespace)

EDIT:
Looking in the kueue workloads definitions I have to change the "active" field in the workloads so looks like I have to use a different API call to modify the workload fields.

https://kueue.sigs.k8s.io/docs/concepts/workload/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant