mountainlab-js icon indicating copy to clipboard operation
mountainlab-js copied to clipboard

Multiple Calls to MLC.addProcess in for loop -> error

Open alexmorley opened this issue 6 years ago • 5 comments

e.g.

async function convert_firings(MLC, dataset_dirname, output_dirname, params, temp_dir) {
  for (tet = 1; tet < params.tetrodes.length+1; tet++) {
    MLC.addProcess({
      processor_name: 'dd.convert_firings',
      inputs: {
        firings: output_dirname + '/firings.mda',
        params: temp_dir + 'params.json'
      },
      outputs: {
        res_fname: output_dirname + '/res.' + tet,
        clu_fname: output_dirname + '/clu.' + tet
      },
      parameters: {
        tetrode:tet
      }
    })
  };
  await MLC.run();
}

Errors like

[...]
Error in find: Unexpected token { in JSON at position 10746 
[...]

I think its a race condition. Maybe two processes trying to write to the database at the same time? Or is this not the intended use?

Is there currently a lock on the database?

alexmorley avatar Jul 24 '18 17:07 alexmorley