-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added more query params * added get_job_details flag * cleanup * Update maap/maap.py Co-authored-by: Chuck Daniels <[email protected]> * Update maap/maap.py Co-authored-by: Chuck Daniels <[email protected]> * Update maap/maap.py Co-authored-by: Chuck Daniels <[email protected]> * added docstring | updated param handling * review updates * review updates * renamed file --------- Co-authored-by: Chuck Daniels <[email protected]>
- Loading branch information
1 parent
f0eefc8
commit 102869c
Showing
2 changed files
with
97 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Valid job statuses (loosely based on OGC job status types) | ||
JOB_STATUSES = {'Accepted', 'Running', 'Succeeded', 'Failed', 'Dismissed', 'Deduped', 'Offline'} | ||
|
||
def validate_job_status(status): | ||
''' | ||
Validates job status | ||
Args: | ||
status (str): Job status. Accepted values are: 'Accepted', 'Running', 'Succeeded', 'Failed, 'Dismissed', 'Deduped', and 'Offline'. | ||
Returns: | ||
status (str): Returns unmodified job status if job status is valid. | ||
Raises: | ||
ValueError: If invalid job status is provided. | ||
''' | ||
if status not in JOB_STATUSES: | ||
valid_statuses = ", ".join(str(status) for status in JOB_STATUSES) | ||
raise ValueError("Invalid job status: '{}'. Job status must be one of the following: {}".format(status, valid_statuses)) | ||
|
||
return status |