-
Notifications
You must be signed in to change notification settings - Fork 360
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
[WX-1792] Helper to Actor #7544
Conversation
) | ||
def onTaskComplete(runStatus: StandardAsyncRunState, handle: StandardAsyncPendingExecutionHandle): Unit = | ||
pollingResultMonitorActor.foreach(helper => | ||
helper.tell(AsyncJobHasFinished(runStatus.getClass.getSimpleName), self) |
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.
Can we pass runStatus
here rather than stringifying it?
} | ||
|
||
class PapiPollResultMonitorActor(tellMetadataFn: Map[String, Any] => Unit, | ||
tellBardFn: (String, OffsetDateTime, Option[OffsetDateTime], OffsetDateTime) => Unit |
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.
Might be worth bringing back the StartAndEndTimes
class, a series of OffsetDateTime
can be easy to mess up.
case event if event.name == CallMetadataKeys.VmEndTime => event.offsetDateTime | ||
} | ||
|
||
override def tellMetadata(metadata: Map[String, Any]): Unit = tellMetadataFn(metadata) |
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.
Can we give this actor a handle to the metadata service registry rather than having all the backends pass in (I assume identical?) implementations?
Similar question for Bard - can we put the actual message-passing to the Bard service in the parent PollResultMonitorActor
and figure out the minimum logic that needs to be per-backend?
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.
That is certainly possible, but I'm not sure if that's a big improvement since we would also need to pass in a lot of information about the particular task (runtime attributes, job descriptor, etc...) in order to have all the information necessary to send the message in the right way. All that other stuff doesn't seem relevant to tracking start and end times, yet we still want to send messages that include more context about their task. The passing of the function object is more about capturing necessary context from the parent class than it is about sharing implementation.
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.
Yeah, I see what you mean, for Bard. Maybe we could have a method that takes the current inputs and creates and returns a TaskSummaryEvent
, which the PollMonitorActor
knows what to do with?
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.
Updated branch to do something along these lines. We no longer pass in callbacks from individual backends, but instead pass in some extra data so that the poll monitors can call their own implementations of tellMetadata
and tellBard
instead. This allowed us to remove tellBard
from elsewhere in the codebase.
} | ||
|
||
// Function that reports metrics to bard, called when a specific call attempt terminates. | ||
def tellBard(terminalStateName: String, |
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.
Moved (almost) verbatim from StandardAsyncExecutionActor
@@ -322,7 +320,6 @@ object TesAsyncBackendJobExecutionActor { | |||
handle: StandardAsyncPendingExecutionHandle, | |||
getTaskLogsFn: StandardAsyncPendingExecutionHandle => Future[Option[TaskLog]], | |||
tellMetadataFn: Map[String, Any] => Unit, | |||
tellBardFn: StandardAsyncRunState => Unit, |
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.
I'm going to create a ticket in this epic to track the fact that we've disabled Bard reporting here.
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.
Nice refactor!
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.
One question otherwise LGTM!
@@ -134,9 +132,8 @@ class PipelinesApiAsyncBackendJobExecutionActor(override val standardParams: Sta | |||
|
|||
override type StandardAsyncRunState = RunStatus | |||
|
|||
override val costHelper: Option[CostPollingHelper[RunStatus]] = Option(new PapiCostPollingHelper(tellMetadata)) | |||
def statusEquivalentTo(thiz: StandardAsyncRunState)(that: StandardAsyncRunState): Boolean = | |||
thiz.toString == that.toString |
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.
Isn't .toString
needed so that Cromwell doesn't log no-op status changes? I thought this was added recently 🤔
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.
YES, thank you!
I tested an image built off this branch in my BEE and confirmed that the |
Description
This PR refactors & renames the
CostCatalogHelper
into thePollResultMonitorActor
. Doing this allows the helper to asynchronously communicate with theCostCatalogService
, which it needs to do in order to calculate a VM Cost Per Hour.Release Notes Confirmation
CHANGELOG.md
CHANGELOG.md
in this PRCHANGELOG.md
because it doesn't impact community usersTerra Release Notes