ProtoLife / daptics-api

API documentation and clients for the daptics.ai design of experiments engine
https://daptics.ai
GNU General Public License v3.0
1 stars 1 forks source link

Cannot save experiments while a update task is active #45

Open nhpackard opened 1 year ago

nhpackard commented 1 year ago

Occasionally the API hangs with message "Cannot save experiments while a update task is active".

Conditions for recreation of the are currently unclear. I typically can execute a couple generations, then the error appears, and the session cannot move forward.

Error occurs after a call like:

newgen = daptics.put_experiments_csv(
    DapticsExperimentsType.DESIGNED_WITH_OPTIONAL_EXTRAS,
    csv_experiments_file)

but error is also generated by calls like:

# Do the experiment:
# simulated experimental response
space = daptics.get_experimental_space()
design = daptics.design
experiments = daptics.random_experiments_with_responses(space, design)
expsim = daptics.simulate_experiment_responses(experiments)

Curiously, if the last example is executed without the last line, the error is not generated.

The full error is:

---------------------------------------------------------------------------
GraphQLError                              Traceback (most recent call last)
Input In [53], in <cell line: 1>()
----> 1 newgen = daptics.put_experiments_csv(
      2     DapticsExperimentsType.DESIGNED_WITH_OPTIONAL_EXTRAS,
      3     csv_experiments_file)

File ~/Projects/daptics-api/python_client/daptics_client/daptics_client.py:2120, in DapticsClient.put_experiments_csv(self, experiments_type, fname)
   2118 else:
   2119     raise CsvNoDataRowsError(fname)
-> 2120 return self.put_experiments(experiments_type, experiments)

File ~/Projects/daptics-api/python_client/daptics_client/daptics_client.py:2025, in DapticsClient.put_experiments(self, experiments_type, experiments)
   2023 else:
   2024     data, errors = self.call_api(doc, vars)
-> 2025 self._raise_exception_on_error(data, errors)
   2027 if 'putExperiments' in data and data['putExperiments'] is not None:
   2028     task_id = data['putExperiments']['taskId']

File ~/Projects/daptics-api/python_client/daptics_client/daptics_client.py:856, in DapticsClient._raise_exception_on_error(self, data, errors)
    853 if not self._successful(data):
    854     if errors:
    855         # This is what gql does with errors
--> 856         raise GraphQLError(str(errors[0]['message']))
    857     else:
    858         raise GraphQLError('Unknown error')

GraphQLError: Cannot save experiments while a update task is active.
pzingg commented 1 year ago

This is an open issue at https://github.com/ProtoLife/pdt-rservex/issues/184

If you have a notebook that can reproduce this error consistently, please send it to me somehow. I would like to try tweaking it with different parameters for sync and async, polling and not polling to see which cases cause the error.