caracal-pipeline / caracal

Containerized Automated Radio Astronomy Calibration (CARACal) pipeline
GNU General Public License v2.0
28 stars 6 forks source link

having multiple targets makes it fall over just after split #606

Closed o-smirnov closed 4 years ago

o-smirnov commented 4 years ago

See below:

meerkathi - 2019-09-28 05:52:08,592 CRITICAL - INFO:STIMELA-9:Adding cab 'oms_cab/pycasacore' to recipe. The container will be named 'flagset_clear_automatic_flagging__2_0'
meerkathi - 2019-09-28 05:52:09,139 ERROR - An unhandled exeption occured. If you think this is a bug please report it.
meerkathi - 2019-09-28 05:52:09,139 ERROR - Your logfile is here: /home/oms/projects/Shapley/log-meerkathi.txt.
meerkathi - 2019-09-28 05:52:09,139 ERROR - You are running version: 0.1.0-1102-g49a6655
meerkathi - 2019-09-28 05:52:09,358 ERROR - Traceback (most recent call last):
  File "/home/oms/projects/meerkathi/meerkathi/main.py", line 159, in __run
    pipeline.run_workers()
  File "/home/oms/projects/meerkathi/meerkathi/workers/worker_administrator.py", line 244, in run_workers
    worker.worker(self, recipe, config)
  File "/home/oms/projects/meerkathi/meerkathi/workers/flagging_worker.py", line 305, in worker
    map(str, utils.get_field_id(msinfo, field_names)))
  File "/home/oms/projects/meerkathi/meerkathi/dispatch_crew/utils.py", line 69, in get_field_id
    raise KeyError("Could not find field '%s'" % field_name)
KeyError: "Could not find field 'A3556,A3562'"
paoloserra commented 4 years ago

pinging @molnard89

molnard89 commented 4 years ago

@o-smirnov how do your config file's "get_data" and "observation_config" bits look like? It shouldn't look for field 'A3556,A3562', it should look for field 'A3556' and 'A3562' I presume?

paoloserra commented 4 years ago

@o-smirnov you'll be happy to hear that this is not an Oleg-only bug. I am able to reproduce it.

@molnard89 and I will look into it and let you know.

o-smirnov commented 4 years ago

this is not an Oleg-only bug.

Phew! Virtually unprecedented! :rofl:

KshitijT commented 4 years ago

@o-smirnov how do your config file's "get_data" and "observation_config" bits look like? It shouldn't look for field 'A3556,A3562', it should look for field 'A3556' and 'A3562' I presume?

It's not really looking for field 'A3556,A3562', that's just the way the error is reported. I think it can't find either 'A3556' or 'A3562' , hence the error. @o-smirnov how do the obsinfo files look?

paoloserra commented 4 years ago

@KshitijT the problem is that it's looking for both those targets in the obsinfo of an .MS that only has one target (post-split). I think that the trouble maker is

https://github.com/ska-sa/meerkathi/blob/1bfd62ac8a01929011a2d8557dd54fd9c2d8e907/meerkathi/workers/flagging_worker.py#L303

This line returns 'A3556,A3562' while what we need there is one target only.

o-smirnov commented 4 years ago

This is what the relevant bit looks like.

Fields: 5
  ID   Code Name                RA               Decl           Epoch   SrcId      nRows
  0    T    PKS0408-65          04:08:20.380000 -65.45.09.10000 J2000   0         132750
  1    T    J1311-222           13:11:39.330000 -22.16.41.00000 J2000   1         637200
  2    T    A3556               13:24:06.000000 -31.40.12.00000 J2000   2        2573580
  3    T    A3562               13:33:35.000000 -31.40.30.00000 J2000   3        2378880
  4    T    PKS1934-63          19:39:25.030000 -63.42.45.70000 J2000   4         263730

Observation_config is all auto.

KshitijT commented 4 years ago

@KshitijT the problem is that it's looking for both those targets in the obsinfo of an .MS that only has one target (post-split). I think that the trouble maker is

https://github.com/ska-sa/meerkathi/blob/1bfd62ac8a01929011a2d8557dd54fd9c2d8e907/meerkathi/workers/flagging_worker.py#L303

This line returns 'A3556,A3562' while it should have returned only one target.

In which case it is looking at the wrong msinfo file. Line 54 of the worker says:

     for j, msname in enumerate(mslist):
            if label:
                fieldName = utils.filter_name(target_ls[j])
                msinfo = '{0:s}/{1:s}-{2:s}-obsinfo.json'.format(
                    pipeline.output, pipeline.prefix, msname[:-3])

whereas it should be looking at the split msinfo file (i.e. the one with the label and the fieldname) - also since field-ids change post-split.

paoloserra commented 4 years ago

The msinfo file is actually the correct one. The solution is to replace field_names with fieldName in

https://github.com/ska-sa/meerkathi/blob/1bfd62ac8a01929011a2d8557dd54fd9c2d8e907/meerkathi/workers/flagging_worker.py#L305

However, this gets me to another problem ('-' replaced with '_') -- working on that.

paoloserra commented 4 years ago

OK, it can be solved by replacing field_names with target_ls[j] in L305 above. I will implement the change in https://github.com/ska-sa/meerkathi/pull/611 and then maybe @KshitijT or @o-smirnov can review