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
[native] Move static functions from PrestoTask to Util. #22617
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amitkdutta thanks for the improvement!
@@ -31,4 +31,9 @@ std::shared_ptr<folly::SSLContext> createSSLContext( | |||
const std::string& clientCertAndKeyPath, | |||
const std::string& ciphers); | |||
|
|||
/// Returns process-wide CPU time in nanoseconds. | |||
long getProcessCpuTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/getProcessCpuTime/getProcessCpuTimeNs/?
/// Returns process-wide CPU time in nanoseconds. | ||
long getProcessCpuTime(); | ||
|
||
std::string taskNumbersToString(const std::array<size_t, 5>& taskNumbers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const std::array<size_t, 5>& taskNumbers
@@ -220,7 +221,7 @@ proxygen::RequestHandler* TaskResource::createOrUpdateTaskImpl( | |||
folly::via( | |||
httpSrvCpuExecutor_, | |||
[this, &body, taskId, createOrUpdateFunc]() { | |||
const auto startProcessCpuTime = PrestoTask::getProcessCpuTime(); | |||
const auto startProcessCpuTime = util::getProcessCpuTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NYC: s/startProcessCpuTime/startProcessCpuTimeNs/
@@ -775,27 +763,6 @@ void PrestoTask::updateExecutionInfoLocked( | |||
prestoTaskStats); | |||
} | |||
|
|||
/*static*/ std::string PrestoTask::taskNumbersToString( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to keep this as static method of PrestoTask as the states are specific to PrestoTask internal
s/taskNumbersToString/taskStatesToString/
@@ -31,4 +31,9 @@ std::shared_ptr<folly::SSLContext> createSSLContext( | |||
const std::string& clientCertAndKeyPath, | |||
const std::string& ciphers); | |||
|
|||
/// Returns process-wide CPU time in nanoseconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to avoid files / classes named Util as they tend to become a "dumping ground" for lots of unrelated code. It would be better to come with more specific names.
Closing this in favor of #22662 |
Description
Minor refactor to move static tasks from PrestoTask struct to Util.
Motivation and Context
We are trying to make PrestoTask a class instead of a struct for better encapsulation. Moving static methods out of the struct makes this easier. Besides the functions we are moving aren't a good fit for PrestoTask.
Impact
No impact.
Test Plan
Existing unit tests