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

Full task sync #2191

Merged
merged 1 commit into from
Nov 4, 2019
Merged

Full task sync #2191

merged 1 commit into from
Nov 4, 2019

Conversation

shubham2892
Copy link
Contributor

@shubham2892 shubham2892 commented Sep 3, 2019

Summary

A new capability full-sync is added which advertises that Agent can handle this new type of messages.

Workflow

When the Agent connects to the ACS , ACS with send a TaskManifest type of message. Agent is expected to:

  1. Check for staleness: The agent will keep track of the highest timeline number received in both PayloadMessage and TaskManifestMessage. If the timeline number on TaskManifestMessage is lower to the latest known one, the TaskManifestMessage must be discarded.

  2. If the Manifest is not stale, compare the list of tasks running on the instance to the list of RUNNING tasks in the Manifest. Tasks not present in the manifest become candidates to be stopped.

  3. If there are stop candidates, Agent will send a TaskStopVerificationMessage to ACS, containing all the tasks it determines need to stop (stop candidates) with a desired status of STOPPED. ACS will then verify if the STOPPED tasks in the message should be terminated. ACS will reply with TaskStopVerificationAck, containing all the tasks that must be terminated with a desired status STOPPED.

  4. The agent must terminate all tasks listed in TaskStopVerificationAck. Exceptions saying the task being terminated does not exist should be ignored. Tasks in the Manifest but NOT on the instance are simply ignored.

image

Implementation details

  • seqNumTaskManifest is added to Agent struct to keep track of latest timeline number Agent has processed.
  • seqNumTaskManifest is stored in the state file so that it can be restored when Agent restarts.
  • seqNumTaskManifest is updated in the state file and Agent struct, on every payload message and TaskManifest message.
  • TaskManifestHandler is added to process new type of messages.

Testing

New tests cover the changes:yes

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@shubham2892 shubham2892 marked this pull request as ready for review September 27, 2019 20:36
@shubham2892 shubham2892 requested a review from a team September 27, 2019 20:36
}
}

func (taskManifestHandler *taskManifestHandler) start() {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we split this out into multiple (probably 2) handlers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be done, but they are a part of one operation(they are incomplete without each other), so will prefer to keep them together, thoughts?

agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/app/agent_capability.go Outdated Show resolved Hide resolved
agent/app/agent.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/acs_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/acs_handler_test.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/api/task/status/taskstatus.go Outdated Show resolved Hide resolved
@shubham2892 shubham2892 added this to the 1.33.0 milestone Oct 23, 2019
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler_test.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Outdated Show resolved Hide resolved
agent/acs/handler/task_manifest_handler.go Show resolved Hide resolved
agent/api/task/status/taskstatus.go Show resolved Hide resolved
agent/app/agent_capability.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants