# Update deprecated use of time.clock()

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Story Points:
0.5
• Sprint:
AP S19-5
• Team:

#### Description

In running some tests involving pipe_base I got this warning:

 /Volumes/ExternalSSD/Users/timj/work/lsstsw37/stack/DarwinX86/pipe_base/16.0-10-g0b41441+6/python/lsst/pipe/base/timer.py:91: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead 

Not urgent yet but the Python developers have now given an explicit timeline for when it will become a problem.

#### Activity

Hide
John Parejko added a comment -

Having just seen a mess of these warnings running jointcal tests, I'd like to clean them up. However, it's not clear to me whether our intended usage here is of the perf_counter or process_time variety. In fact, given that we're logging that value and not doing differences in this code, it seems to me that neither of those options is correct for us. Is the value of cpuTime logged by pipe.base.timer.logInfo() used anywhere?

Show
John Parejko added a comment - Having just seen a mess of these warnings running jointcal tests, I'd like to clean them up. However, it's not clear to me whether our intended usage here is of the perf_counter or process_time variety. In fact, given that we're logging that value and not doing differences in this code, it seems to me that neither of those options is correct for us. Is the value of cpuTime logged by pipe.base.timer.logInfo() used anywhere?
Hide
Tim Jenness added a comment -

I didn't fix it because I had no idea what the right answer was. Russell Owen wrote the initial code so maybe he has some thoughts. time.process_time seems to be closest.

Show
Tim Jenness added a comment - I didn't fix it because I had no idea what the right answer was. Russell Owen wrote the initial code so maybe he has some thoughts. time.process_time seems to be closest.
Hide
John Parejko added a comment -

Good, that makes three of us: Russell Owen also said he thought process_time was most appropriate.

Tim Jenness: can you do this small review, please? It got rid of the warnings I was seeing in jointcal.

Show
John Parejko added a comment - Good, that makes three of us: Russell Owen also said he thought process_time was most appropriate. Tim Jenness : can you do this small review, please? It got rid of the warnings I was seeing in jointcal. Jenkins run: https://ci.lsst.codes/blue/organizations/jenkins/stack-os-matrix/detail/stack-os-matrix/29612/pipeline
Hide
Tim Jenness added a comment -

Looks okay to me given what we know about the problem.

Show
Tim Jenness added a comment - Looks okay to me given what we know about the problem.
Hide
John Parejko added a comment -

Thanks for the quick review.

Merged and done.

Show
John Parejko added a comment - Thanks for the quick review. Merged and done.

#### People

Assignee:
John Parejko
Reporter:
Tim Jenness
Reviewers:
Tim Jenness
Watchers:
John Parejko, John Swinbank, Russell Owen, Tim Jenness