-
Notifications
You must be signed in to change notification settings - Fork 604
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 scheduled state for delegated_ops collection #4810
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6c69528
add pending and pending_at states for being used in scheduler
CamronStaley 7b6e474
fix update_run_state to properly handle pending state
CamronStaley fd78b12
Add missing quote
CamronStaley 336d675
Refactor DO doc for clarity
CamronStaley 311193e
more refactoring in DO doc
CamronStaley 0c21123
add unit tests for new methods
CamronStaley 8827bd3
update terminology from pending to scheduled
CamronStaley 831eb89
update missed pending to scheduled
CamronStaley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,32 +46,36 @@ def __init__( | |
self.pinned = False | ||
self.completed_at = None | ||
self.failed_at = None | ||
self.scheduled_at = None | ||
self.result = None | ||
self.id = None | ||
self._doc = None | ||
self.metadata = None | ||
|
||
def from_pymongo(self, doc: dict): | ||
# required fields | ||
self.operator = doc["operator"] | ||
self.queued_at = doc["queued_at"] | ||
self.run_state = doc["run_state"] | ||
self.label = doc["label"] if "label" in doc else None | ||
self.updated_at = doc["updated_at"] if "updated_at" in doc else None | ||
self.operator = doc.get("operator") | ||
self.queued_at = doc.get("queued_at") | ||
self.run_state = doc.get("run_state") | ||
|
||
# optional fields | ||
self.delegation_target = ( | ||
doc["delegation_target"] if "delegation_target" in doc else None | ||
) | ||
self.started_at = doc["started_at"] if "started_at" in doc else None | ||
self.completed_at = ( | ||
doc["completed_at"] if "completed_at" in doc else None | ||
) | ||
self.failed_at = doc["failed_at"] if "failed_at" in doc else None | ||
self.pinned = doc["pinned"] if "pinned" in doc else None | ||
self.dataset_id = doc["dataset_id"] if "dataset_id" in doc else None | ||
self.run_link = doc["run_link"] if "run_link" in doc else None | ||
self.delegation_target = doc.get("delegation_target", None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically |
||
self.started_at = doc.get("started_at", None) | ||
self.completed_at = doc.get("completed_at", None) | ||
self.failed_at = doc.get("failed_at", None) | ||
self.scheduled_at = doc.get("scheduled_at", None) | ||
self.pinned = doc.get("pinned", None) | ||
self.dataset_id = doc.get("dataset_id", None) | ||
self.run_link = doc.get("run_link", None) | ||
self.metadata = doc.get("metadata", None) | ||
self.label = doc.get("label", None) | ||
self.updated_at = doc.get("updated_at", None) | ||
|
||
# internal fields | ||
self.id = doc["_id"] | ||
self._doc = doc | ||
|
||
# nested fields | ||
if ( | ||
"context" in doc | ||
and doc["context"] is not None | ||
|
@@ -100,12 +104,6 @@ def from_pymongo(self, doc: dict): | |
if "updated_at" in doc["status"]: | ||
self.status.updated_at = doc["status"]["updated_at"] | ||
|
||
# internal fields | ||
self.id = doc["_id"] | ||
self._doc = doc | ||
|
||
self.metadata = doc["metadata"] if "metadata" in doc else None | ||
|
||
return self | ||
|
||
def to_pymongo(self) -> dict: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Don't really need to use
get()
for these as they're required to be set. It just pushes the errors to later