Skip to content
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

Execute dependent job when all dependencies finished. #382

Merged
merged 8 commits into from Jul 31, 2020

Conversation

jeschkies
Copy link
Contributor

@jeschkies jeschkies commented Jul 29, 2020

Summary:
This the business logic of MIP 0008 "Jobs with Dependencies". We had an actor analog
to the JobSpecSchedulerActor. This new actor subscribes to all job run events and updates
an internal state. Once all parents have a successful run that is new than the child run we
trigger new job execution.

JIRA issues: DCOS_OSS-5974

Summary:
tbd

JIRA issues: DCOS_OSS-5974
@jeschkies jeschkies marked this pull request as ready for review July 30, 2020 12:29
if (dependenciesState.shouldTriggerJob(lastSuccessfulRun)) {
log.info(s"Start next run of job ${spec.id}, all parents finished successfully")
runService.startJobRun(initSpec).pipeTo(self)
context.become(running)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I told @pierrebeitz already what limitation we have with this.

First, I think we need to handle the result of startJobRun. It stands to question whether we need another receive method for that.

Second and this is more important, I saw job runs triggered each time there was an update. Imagine C run five seconds depends on A and B. B is run every ten seconds but A every ten millis. This would trigger C multiple times.

A way to avoid this is to save the lastCreatedAt for C and use this as well to check whether we already scheduled a run for C or not. I will create a follow up as a proposal.

class JobSpecDependencyActor(initSpec: JobSpec, runService: JobRunService) extends Actor with Stash with ActorLogging {

private[impl] var spec = initSpec
private[impl] var lastSuccessfulRun: Instant = Instant.MIN
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should load the last job run as a failover pattern?

@jeschkies jeschkies changed the title Execute dependent job when all dependencies finised. Execute dependent job when all dependencies finished. Jul 31, 2020
@jeschkies jeschkies merged commit b336ea0 into master Jul 31, 2020
@jeschkies jeschkies deleted the karsten/execute-dependent-job branch July 31, 2020 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants