|
When using a shared database, how do I cancel only jobs submitted with run_cloud with a specific tag? |
Answered by
jacksund
May 13, 2023
Replies: 2 comments 2 replies
|
If you submit jobs with something like this... for structure in structures:
status = workflow.run_cloud(
structure=structure,
tags = ["radomster", "attempt-2"],
)Then you can cancel those jobs in python with one of these options.... from simmate.database import connect
from simmate.engine.execution import WorkItem
# viewing ALL jobs (pending, running, completed, etc.)
all_jobs = WorkItem.objects.to_dataframe()
# Filtering jobs with specific tags
# option 1
radomster_jobs = WorkItem.objects.filter(
tags=["radomster", "attempt-2"],
status="P", # Pending (optional filter)
).all()
# option 2 ("__contains" only works with postgres!)
radomster_jobs_2 = WorkItem.objects.filter(tags__contains="attempt-2").all()
# canceling jobs that you pulled
for job in radomster_jobs:
job.cancel() |
0 replies
|
in the next release (v0.14.0) you'll be able to delete jobs using this command: |
2 replies
Answer selected by
jacksund
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in the next release (v0.14.0) you'll be able to delete jobs using this command: