Re-run a pipeline from within a module

cellprofiler

#1

Hi,

I am trying to build a module which can adjust some of the settings in previous modules.
Getting the old settings from the modules and setting new ones with calling

setting.set_value(new_Setting_Value) and pipeline.edit_module(module_to_be_altered, is_image_set_modification=False)

works fine. I tried to execute the module in debug/test mode. The module would successfully adjust the settings and automatically re-run the pipeline from the module where the setting was changed. (though I could not find out why the pipeline does automatically re-run??)

The problem is that the debug-continue-index would not be set back to the module which was altered and automatically caused the pipeline to re-run from this point. This causes the execution to crash at the point where the debug mode tries to fetch the next module to execute while the index is already at the total number of modules at the pipeline.

(To give an example, let’s say I have 27 modules in my pipeline, the module which changes previous settings is module no. 20.
When running the test mode, the pipeline executes until module no. 20. Then, module 20 changes settings in module no. 5. The pipeline will then automatically re-run, beginning from module no. 5. Problem: The overall counter is now already at module 25, meaning it is not executing the whole pipeline again but crashing at module no. 8 now, as the index has reached the max. no. of modules)

Here is the traceback:
Traceback (most recent call last):
File “/Users/CellProfiler/cellprofiler/gui/pipelinecontroller.py”, line 2979, in on_debug_continue
wants_continue, wants_skip = dlg.Update(index, message)
File “/anaconda2/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_windows.py”, line 3704, in Update
return windows.GenericProgressDialog_Update(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion “value <= m_maximum” failed at /BUILD/wxPython-src-3.0.0.0/src/generic/progdlgg.cpp(435) in Update(): invalid progress value

Is there any way to re-set the index of the debug mode when altering the settings so that re-running from the altered module can then execute the full remaining pipeline again?

Thanks,
Lisa


#2

Hi Lisa,

Yes, see this function, which is used in the context to set the module to run from in case the user wants to “jump back” but should also work for your purposes.


#3

Hi Beth,
thank you! I’ve seen this function before, but I was wondering how to access it from within my module’s run method.
Other than the pipeline, I cannot directly access the pipeline controller object, can I?


#4

I’m not sure- you may want to make a GitHub issue with the code and ask for input on the best way to accomplish this there.


#5

I did so. I think it might be a bug in the edit_module logic and corresponding function calls.