-
Notifications
You must be signed in to change notification settings - Fork 343
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
Add scan operation runs by status method #15424
Conversation
samdgupi
commented
Nov 10, 2023
- Added a new store method to fetch operation runs by status
- Added builder pattern to operation meta
- Fixed some issues with current store methods
- Added a operation test base class as some of this functions will be shared with other tests later
/** | ||
* Scan all pending operations. Needed for try running all pending operation during startup. | ||
* | ||
* @param txBatchSize batch size of transaction |
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.
will remove the unused param
cdap-app-fabric/src/main/java/io/cdap/cdap/internal/operation/OperationRunStore.java
Show resolved
Hide resolved
c98e762
to
0a93ad2
Compare
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.
minor comments
@@ -41,7 +42,7 @@ public class OperationMeta { | |||
* @param createTime timestamp when the operation was created | |||
* @param endTime timestamp when the operation reached an end state | |||
*/ | |||
public OperationMeta(Set<OperationResource> resources, Instant createTime, @Nullable Instant endTime) { | |||
private OperationMeta(Set<OperationResource> resources, Instant createTime, @Nullable Instant endTime) { |
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.
indentation
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.
done
} | ||
|
||
public Builder setResources(Set<OperationResource> resources) { | ||
this.resources = resources; |
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.
safer to be defensive here and clear the existing resources, then add all the input (would need to change the constructor to create a modifiable Set)
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.
the existing code should also be returning an UnmodifiableSet for getResources()
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.
done
* @param meta existing meta to copy fields from | ||
*/ | ||
public static Builder builder(OperationMeta meta) { | ||
return new Builder(meta); |
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.
can create the new builder and call the .setXYZ() methods here, to make sure the logic will always be consistent
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.
done
@@ -48,6 +48,8 @@ public boolean canTransitionTo(OperationRunStatus status) { | |||
return true; | |||
} | |||
switch (this) { | |||
case PENDING: | |||
return status == STARTING || status == STOPPING; |
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.
can it ever go directly to failed?
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.
No the failure message is only send for runtime/runner after STARTING message is processed.
0a93ad2
to
3ce4180
Compare
3ce4180
to
08b722f
Compare
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.
one comment about removing guava from proto
08b722f
to
8108af6
Compare
8108af6
to
87d79a6
Compare
[🍒 ] Add pending run scan method from #15424