Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AlexKurek opened this issue Jul 27, 2020 · 8 comments
Open

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

AlexKurek opened this issue Jul 27, 2020 · 8 comments

Comments

@AlexKurek
Copy link

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

2020-07-27 18:15:48 - DEBUG - �[35mAppending to /storage/kurek/native/working_directory/Pre-Facet-Calibrator/instrument.h5imp_cal_PA.�[0m
2020-07-27 18:15:48 - INFO - �[32m--> Starting 'plotP3' step (operation: PLOT).�[0m
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
Copy link
Contributor

tikk3r commented Jul 29, 2020

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
Copy link
Owner

@AlexKurek what python version do you use?

@AlexKurek
Copy link
Author

@revoltek For Prefactor I use 2.7.17

@revoltek
Copy link
Owner

revoltek commented Aug 1, 2020

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

@AlexKurek
Copy link
Author

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

@tikk3r
Copy link
Contributor

tikk3r commented Aug 3, 2020

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
Copy link
Owner

revoltek commented Aug 3, 2020

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
Copy link
Contributor

tikk3r commented Aug 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants