Probably put this in conda-store-server/conda_store_server/worker/tasks.py.
Something like (we use a similar pattern in other places, e.g., BuildKey):
# Singleton class that hides impl details, supposed to be used only via class methods
class TaskId:
_ids = {
"build-conda-env-export": "build-{build_id}-conda-env-export",
...
# more task ids here
}
# add another method allowing to get all ids, e.g., to be able to cancel all build-specific tasks
# we have non-build task ids as well - add a way to get a group of tasks? maybe something like build_ids and other
@classmethod
def get_task_id_build_conda_env_export(cls, build_id):
# use the _ids above
...
Then this needs to be used in create_build and api_put_build_cancel.
Value and/or benefit
Ids to cancel will be automatically updated, which is less error-prone
Context
See https://github.com/conda-incubator/conda-store/pull/531#discussion_r1298250683
Probably put this in
conda-store-server/conda_store_server/worker/tasks.py
.Something like (we use a similar pattern in other places, e.g.,
BuildKey
):Then this needs to be used in
create_build
andapi_put_build_cancel
.Value and/or benefit
Ids to cancel will be automatically updated, which is less error-prone
Anything else?
No response