queue the process instance AFTER unlocking it, do not set celery worker concurrency to 12, log already locked error in celery workers for debugging

This commit is contained in:
jasquat 2023-12-07 10:22:50 -05:00
parent d4e0fc69fd
commit 4d6358b0e7
2 changed files with 8 additions and 5 deletions

View File

@ -10,4 +10,4 @@ set -o errtrace -o errexit -o nounset -o pipefail
export SPIFFWORKFLOW_BACKEND_CELERY_ENABLED=true
export SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER_IN_CREATE_APP=false
poetry run celery -A src.spiffworkflow_backend.background_processing.celery_worker worker --loglevel=info -c 12
poetry run celery -A src.spiffworkflow_backend.background_processing.celery_worker worker --loglevel=info

View File

@ -38,10 +38,13 @@ def celery_task_process_instance_run(process_instance_id: int, task_guid: str |
future_task.completed = True
db.session.add(future_task)
db.session.commit()
if task_runnability == TaskRunnability.has_ready_tasks:
queue_process_instance_if_appropriate(process_instance)
except ProcessInstanceIsAlreadyLockedError:
pass
if task_runnability == TaskRunnability.has_ready_tasks:
queue_process_instance_if_appropriate(process_instance)
except ProcessInstanceIsAlreadyLockedError as exception:
current_app.logger.info(
f"Could not run process instance with worker: {current_app.config['PROCESS_UUID']} - {proc_index}. Error was:"
f" {str(exception)}"
)
except Exception as e:
db.session.rollback() # in case the above left the database with a bad transaction
error_message = (