MonashBioinformaticsPlatform / laxy

Laxy Genomics Pipelines
Apache License 2.0
3 stars 1 forks source link

RuntimeError: Updating a SampleSet .. when starting new job #71

Closed pansapiens closed 3 years ago

pansapiens commented 5 years ago

This error sometimes occurs when a user submits a new job via the web UI (clicks the Start Job button). It's not clear exactly how to replicate this, but it's been seen at least twice.

I suspect it could be a 'race condition' between multiple POST requests sent by the UI - eg a sampleset save and a job start request. In PipelineParams.vue, run() is called when a user clicks the "Start Job" button. Based on this code I'd expect the sampleset save() request to complete before the POST /api/v1/job/?pipeline_run_id=... to start the job. It could be a case of the user mashing the "Start Job" button twice, before the page redirects ?


RuntimeError: Updating a SampleSet once the job field is set is not allowed.,
    raise RuntimeError("Updating a SampleSet once the job field is set is not allowed."),
  File "/app/laxy_backend/models.py", line 1399, in prevent_sampleset_update_after_job_assigned,
  File "/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>,
  File "/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 175, in send,
    update_fields=update_fields,,
    force_update=force_update, update_fields=update_fields),
  File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 743, in save_base,
    sampleset.save(),
  File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 718, in save,
  File "/app/laxy_backend/views.py", line 1677, in post,
    response = view_method(instance, request, version=version, *args, **kwargs),
  File "/usr/local/lib/python3.6/site-packages/drf_openapi/utils.py", line 27, in wrapper,
    response = handler(request, *args, **kwargs),
  File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 492, in dispatch,
  File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 455, in handle_exception,
    response = self.handle_exception(exc),
    self.raise_uncaught_exception(exc),
    return self.dispatch(request, *args, **kwargs),
  File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 495, in dispatch,
  File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view,
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view,
    return view_func(*args, **kwargs),
Traceback (most recent call last):,
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner,
    response = get_response(request),
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response,
    response = self.process_exception_by_middleware(e, request),
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response,
    response = wrapped_callback(request, *callback_args, **callback_kwargs),
Internal Server Error: /api/v1/job/,
  RuntimeWarning),
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1421: RuntimeWarning: DateTimeField Job.expiry_time received a naive datetime (2019-08-17 01:08:40.371688) while time zone support is active.```
pansapiens commented 3 years ago

Addressed by: ddd2375c5f845ca206857aaa64ca9fb5f4d551cd