revoltek / losoto

LOFAR solutions tool
GNU General Public License v3.0
11 stars 21 forks source link

AttributeError: 'module' object has no attribute 'perf_counter' #103

Closed AlexKurek closed 3 weeks ago

AlexKurek commented 4 years ago

Using current master when I try to run Prefactor Im getting at calibrator step:

2020-07-27 18:15:48 - DEBUG - Appending to /storage/kurek/native/working_directory/Pre-Facet-Calibrator/instrument.h5imp_cal_PA. 2020-07-27 18:15:48 - INFO - --> Starting 'plotP3' step (operation: PLOT). Closing remaining open files: /storage/kurek/native/working_directory/Pre-Facet-Calibrator/instrument.h5imp_cal_PA...

2020-07-27 18:15:48 WARNING node.lof5.executable_args.instrument.h5imp_cal_PA: /opt/LoSoTo//bin/losoto stderr: Traceback (most recent call last): File "/opt/LoSoTo//bin/losoto", line 4, in import('pkg_resources').run_script('losoto==2.1', 'losoto') File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 666, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1462, in run_script exec(code, namespace, namespace) File "/opt/LoSoTo/lib/python2.7/site-packages/losoto-2.1-py2.7.egg/EGG-INFO/scripts/losoto", line 150, in with operations.Timer(logging, step, op) as t: File "/opt/LoSoTo/lib/python2.7/site-packages/losoto-2.1-py2.7.egg/losoto/operations/init.py", line 27, in enter self.startcpu = time.perf_counter() AttributeError: 'module' object has no attribute 'perf_counter'

2020-07-27 18:15:51 ERROR node.lof5.executable_args: Command '/opt/LoSoTo//bin/losoto' returned non-zero exit status 1

Full log is attached: pipeline-Pre-Facet-Calibrator-2020-07-27T15%3A52%3A27.zip

tikk3r commented 4 years ago

It seems time.perf_counter was introduced in Python 3.3, so it will not work in genericpipeline pipelines as those only run under Python 2. Perhaps adding a fallback to time.clock to maintain compatability is useful.

revoltek commented 4 years ago

@AlexKurek what python version do you use?

AlexKurek commented 4 years ago

@revoltek For Prefactor I use 2.7.17

revoltek commented 4 years ago

The master of losoto is only python 3, I think you need to go back to an older release (1.0)

AlexKurek commented 4 years ago

I was able to run entire Prefactor using second to last commit :)

tikk3r commented 4 years ago

Fully supporting the move of stuff to Python 3, but I think it is worth noting that this will make losoto unusable in and break prefactor currently, as the genericpipeline does not run under Python 3. This should be fixed once the CWL version is done, but I don't know the status of that.

I think a lot has changed and been added since 1.0 and 2.0 that is currently being used right?

I was able to run entire Prefactor using second to last commit :)

Could this commit perhaps be made a 2.1 or some other intermittent release in that case? That would give a nice reference point from where on it no longer works for Python 2 / prefactor.

revoltek commented 4 years ago

Hum, there are a large number of python3 specific parts in losoto since release 2.0, I think not all operations work in python2 nor I can be sure of the results. Actually, I really though python2 was not working at all with the latest master. The easiest is to add a 'try' to just account for this

tikk3r commented 4 years ago

Ah I didn't realize that. I guess we got extremely lucky the past years then haha.