-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
flow trigger/dependency instance #1611
flow trigger/dependency instance #1611
Conversation
} | ||
|
||
@Test | ||
public void testTriggerInstanceStatus() throws Exception { |
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.
It looks like this is multiple tests wrapped inside a single test method, is that right? If so, it'll be easier to parallelize if broken out into multiple smaller tests. That would also make it easier for us to identify quickly what is broken and why if a test fails.
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.
thanks, updated.
} | ||
|
||
@Test | ||
public void testTriggerInstanceStartTimeEndTime() throws Exception { |
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.
Same as last comment.
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.
thanks, updated.
Other than that it looks good! Check out comments then I'll give ship-it. |
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.
LGTM!
The PR added JDBC loader for flow trigger. The loader provides all DB related operations for flow trigger instance and dependency instance(#1611) to interact with dependency instance table(#1612). The PR also added toString(), hashCode() and equals() to several existing classes for complementary purpose.
PR added two core classes for flow trigger feature: TriggerInstance and DependencyInstance.
Conceptually trigger Instance represents an execution of a flow trigger. It holds execution context such as a historically unique trigger execution id, execution status, start/end time, and a list of dependency instances.
Similarly dependency Instance denotes an execution of a dependency performing availability check on a particular data dependency. It holds execution context such as execution status and start/end time, all dependency Instances within the same trigger instance share the same execution id as trigger instance.
A trigger instance and its dependency instances will be created on scheduled trigger start time. The trigger instance will wait until all dependency instances are available, at which point a new flow instance is created, or the maximum allowed wait time is exceeded. Once successfully created, trigger instance will equipped with an UUID to identify itself, initial status as running, and a list of dependency instances whose status are running as well.
Trigger instance can be cancelled manually by user, by timeout when max waiting time is exceeded, or by internal dependency failure.
Trigger/Dependency instance has following status(Running, Cancelling, Cancelled, Succeeded).
Since trigger instance is nothing but a collection of dependency instances, it doesn’t have variables to keep status, start or endtime, all of which can be quickly inferred from its belonging dependencies’ status, start/endtime, which unburdens us from maintaining extra variables.
Cancellation cause will be attached to dependency instance for better user experience when cancelled for whatever reason.
Valid cancellation cause includes:
TIMEOUT, // cancellation is issued due to exceeding max wait time
MANUAL, // cancellation is issued by user
FAILURE, // cancellation is issued by internal dependency instance failure
CASCADING // cancelled by cascading failure(peer dependency is cancelled)