AssertionError when segmenting experiment with new logfile format
Summary
When user segments an experiment (using the 'Run' notebook on skeletons
) that has the new logfile format (i.e. not the one specified in https://git.ecdf.ed.ac.uk/swain-lab/aliby/aliby/-/tree/dev/src/logfile_parser/grammars), an AssertionError
is raised and the experiment is aborted.
The new logfile format is used on Batman and is described at the beginning of https://git.ecdf.ed.ac.uk/swain-lab/aliby/skeletons/-/blob/cdf3699d8c802ea908c18197fe84d7e25f2e41ce/scripts/dev/slim_newlogfile.py
Steps to reproduce
Use aliby
0.1.48 or 0.1.49 on jura
. Use https://git.ecdf.ed.ac.uk/swain-lab/aliby/skeletons/-/blob/master/notebooks/2.%20Run%20experiment.ipynb. Select experiment 470 on staffa
.
See error in tracebacks.
Experiment 409 does not cause this error.
What is the current bug behavior?
An AssertionError
is raised and the experiment is aborted.
What is the expected correct behavior?
Pipeline should recognise the new logfile format and should proceed to completion.
Logs/Traceback
<traceback object at 0x7efd81f5d600>
<class 'AssertionError'>
Reference channel not in the available channels
Caught exception in worker thread (x = YST_1510_005):Caught exception in worker thread (x = YST_1510_003):<traceback object at 0x7efd81fa8a80>
Traceback (most recent call last):
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py", line 380, in create_pipeline
steps["tiler"] = Tiler.from_image(
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 258, in from_image
return cls(image.data, image.metadata, parameters)
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 231, in __init__
assert (
AssertionError: Reference channel not in the available channels
Traceback (most recent call last):
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py", line 380, in create_pipeline
steps["tiler"] = Tiler.from_image(
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 258, in from_image
return cls(image.data, image.metadata, parameters)
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 231, in __init__
assert (
<class 'AssertionError'>
AssertionError: Reference channel not in the available channels
Reference channel not in the available channels
<traceback object at 0x7efd81f77740><class 'AssertionError'>
Reference channel not in the available channels
<traceback object at 0x7efd81e78440>
Caught exception in worker thread (x = YST_1511_002):
... (error repeats for all other positions, see full traceback in attachment: issue-038-traceback.txt) ...
---------------------------------------------------------------------------
RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/multiprocess/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/multiprocess/pool.py", line 48, in mapstar
return list(map(*args))
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py", line 321, in <lambda>
lambda x: self.create_pipeline(*x),
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py", line 523, in create_pipeline
raise e
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py", line 380, in create_pipeline
steps["tiler"] = Tiler.from_image(
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 258, in from_image
return cls(image.data, image.metadata, parameters)
File "/opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/tile/tiler.py", line 231, in __init__
assert (
AssertionError: Reference channel not in the available channels
"""
The above exception was the direct cause of the following exception:
AssertionError Traceback (most recent call last)
Cell In [4], line 25
5 params = PipelineParameters.default(
6 general={
7 "expt_id": 470, # Replace this number for the one of your experiment
(...)
21 }
22 )
23 p = Pipeline(params)
---> 25 p.run()
File /opt/tljh/user/envs/aliby/lib/python3.8/site-packages/aliby/pipeline.py:320, in Pipeline.run(self)
318 if distributed != 0: # Gives the number of simultaneous processes
319 with Pool(distributed) as p:
--> 320 results = p.map(
321 lambda x: self.create_pipeline(*x),
322 [(k, i) for i, k in enumerate(image_ids.items())],
323 # num_cpus=distributed,
324 # position=0,
325 )
327 else: # Sequential
328 results = []
File /opt/tljh/user/envs/aliby/lib/python3.8/site-packages/multiprocess/pool.py:364, in Pool.map(self, func, iterable, chunksize)
359 def map(self, func, iterable, chunksize=None):
360 '''
361 Apply `func` to each element in `iterable`, collecting the results
362 in a list that is returned.
363 '''
--> 364 return self._map_async(func, iterable, mapstar, chunksize).get()
File /opt/tljh/user/envs/aliby/lib/python3.8/site-packages/multiprocess/pool.py:771, in ApplyResult.get(self, timeout)
769 return self._value
770 else:
--> 771 raise self._value
AssertionError: Reference channel not in the available channels
Possible fixes
Grammar is effectively hard-coded in this function definition: https://git.ecdf.ed.ac.uk/swain-lab/aliby/aliby/-/blob/b206c48a180a9a04eeebbe7f06ea0fa8fefaa4af/src/aliby/pipeline.py#L150. Here, parse_logfiles
is called using default arguments, which are defined in https://git.ecdf.ed.ac.uk/swain-lab/aliby/aliby/-/blob/b206c48a180a9a04eeebbe7f06ea0fa8fefaa4af/src/agora/io/metadata.py#L77 to point to the 'old' logfile format. So in theory, load_logs
should be engineered so that a different logfile grammar can be used.
This https://git.ecdf.ed.ac.uk/swain-lab/aliby/skeletons/-/blob/cdf3699d8c802ea908c18197fe84d7e25f2e41ce/scripts/dev/slim_newlogfile.py may also hold some clues.