I have an ipython notebook that runs several steps in a data processing routine and saves information in files along the way. This way, while developing my code (mostly in a separate .py module), I can skip to and run various steps. I'd like to set it up so that I can Cell
->run all
but only have it execute certain chosen steps that would be easily chosen. e.g., I'd envision defining the steps I want to run in a dict like so:
process = {
'load files':False,
'generate interactions list':False,
'random walk':True,
'dereference walk':True,
'reduce walk':True,
'generate output':True
}
then the steps would run based on this dict. BTW, each step comprises multiple cells.
I think %macro
is not quite what I want since anytime I changed anything or restarted the kernel I'd have to redefine the macro, with changing cell numbers.
Is there like a %skip
or %skipto
magic or something along those lines? Or perhaps a clean way to put at the beginning of cells, if process[<current step>]: %dont_run_rest_of_cell
?