Skip to content

Instantly share code, notes, and snippets.

@scottfrazer
Created April 25, 2016 20:00
Show Gist options
  • Save scottfrazer/a83afe07d9e9aa58b62b690f6364a56b to your computer and use it in GitHub Desktop.
Save scottfrazer/a83afe07d9e9aa58b62b690f6364a56b to your computer and use it in GitHub Desktop.
/** 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