Created
April 25, 2016 20:00
-
-
Save scottfrazer/a83afe07d9e9aa58b62b690f6364a56b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** PBE: the return value of WorkflowExecutionActorState is just temporary. | |
* This should probably return a Try[BackendJobDescriptor], Unit, Boolean, | |
* Try[ActorRef], or something to indicate if the job was started | |
* successfully. Or, if it can fail to start, some indication of why it | |
* failed to start | |
*/ | |
private def startJob(call: Call, index: Option[Int], attempt: Int, inputs: Map[FullyQualifiedName, WdlValue]): WorkflowExecutionActorState = { | |
val jobKey = BackendJobDescriptorKey(call, index, attempt) | |
val jobDescriptor = BackendJobDescriptor(workflowDescriptor.backendDescriptor, jobKey, inputs) | |
val configDescriptor = BackendConfigurationDescriptor(ConfigFactory.parseString("{}"), ConfigFactory.load()) | |
workflowDescriptor.backendAssignments.get(call) match { | |
case None => | |
val message = s"Could not start call ${call.fullyQualifiedName} because it was not assigned a backend" | |
log.error(s"$tag $message") | |
context.parent ! WorkflowExecutionFailedResponse(Seq(new Exception(message))) | |
WorkflowExecutionFailedState | |
case Some(backendName) => | |
CromwellBackend.shadowBackendLifecycleFactory(backendName) match { | |
case Success(factory) => | |
val jobExecutionActor = context.actorOf( | |
factory.jobExecutionActorProps(jobDescriptor, configDescriptor), | |
s"$workflowId-BackendExecutionActor-${jobDescriptor.key.tag}" | |
) | |
jobExecutionActor ! ExecuteJobCommand | |
WorkflowExecutionInProgressState | |
case Failure(ex) => | |
context.parent ! WorkflowExecutionFailedResponse(Seq(ex)) | |
WorkflowExecutionFailedState | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment