-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issue 41 #87
Merged
Merged
Issue 41 #87
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
94b9bb7
basic version of command line validator
juliacollins 1e6b545
clean up comments and help text
juliacollins 94f9dae
Merge branch 'main' into issue-41
juliacollins 534a09b
use cli option to specify cnm validation
juliacollins 504a87e
update lock file
juliacollins a3b94e8
update file permissions, ensure cnms file information is json, add ve…
juliacollins 7ce115c
set aside a couple of changes before merge with main
juliacollins 2aaad72
Merge branch 'main' into issue-41
juliacollins f25581a
reconcile cnm message population with issue-42 changes
juliacollins 9d1082a
remove OBE code, use file path convenience functions in config.py
juliacollins 0b98efc
Merge branch 'main' into issue-41
juliacollins 9c4387d
remove old scrubbing code, add logging of validation action
juliacollins f1abcb5
Merge branch 'main' into issue-41
juliacollins 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,276 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"file": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"description": "The type of file. science files (netcdf, HDF, binary) should use the 'data' type. More can be added if need and consensus demand.", | ||
"type": "string", | ||
"enum": [ | ||
"data", | ||
"browse", | ||
"metadata", | ||
"ancillary", | ||
"linkage" | ||
] | ||
}, | ||
"subtype": { | ||
"description": "An optional, specific implmentation of the file::type. e.g. NetCDF for a file of type 'data'", | ||
"type": "string" | ||
}, | ||
"uri": { | ||
"description": "the URI of the file (s3://...)", | ||
"type": "string" | ||
}, | ||
"name": { | ||
"description": "The human readable filename that this file represents. ", | ||
"type": "string" | ||
}, | ||
"checksumType": { | ||
"description ": "Type of the checksum (e.g. md5). Optional. If no checksumType is defined for a file, it is assumed to be md5", | ||
"type": "string", | ||
"enum": [ | ||
"SHA512", | ||
"SHA256", | ||
"SHA2", | ||
"SHA1", | ||
"md5" | ||
] | ||
}, | ||
"checksum": { | ||
"description": "Checksum of the file.", | ||
"type": "string" | ||
}, | ||
"size": { | ||
"description": "Size, in bytes, of the file.", | ||
"type": "number" | ||
} | ||
}, | ||
"required": [ | ||
"type", | ||
"uri", | ||
"size", | ||
"name" | ||
] | ||
}, | ||
"filegroup": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "string id of the filegroup by which all files are associated." | ||
}, | ||
"files": { | ||
"description": "array of files that make up this product", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/file" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"id", | ||
"files" | ||
] | ||
}, | ||
"collection": { | ||
"description": "The collection short name and version.", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "collection short name." | ||
}, | ||
"version": { | ||
"type": "string", | ||
"description": "collection version." | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"version" | ||
] | ||
} | ||
}, | ||
"title": "Cloud Notification Message (cnm) 1.2 ", | ||
"description": "A message format to trigger or respond to processing. Version 1.2", | ||
"type": "object", | ||
"properties": { | ||
"version": { | ||
"description": "The CNM Version used. e.g. '1.3'", | ||
"type": "string", | ||
"enum": [ | ||
"1.0", | ||
"1.1", | ||
"1.2", | ||
"1.3", | ||
"1.4", | ||
"1.4.1", | ||
"1.5", | ||
"1.5.1", | ||
"1.6.0", | ||
"1.6.1-alpha.0", | ||
"1.6.1" | ||
] | ||
}, | ||
"receivedTime": { | ||
"description": "Time message was received by the ingest system", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"processCompleteTime": { | ||
"description": "The time processing completed by the receiving entity.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"submissionTime": { | ||
"description": "The time the message was created (and presumably sent) to the publication mechanism.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"identifier": { | ||
"description": "Unique identifier for the message as a whole. It is the senders responsibility to ensure uniqueness. This identifier can be used in response messages to provide tracability.", | ||
"type": "string" | ||
}, | ||
"collection": { | ||
"description": "The collection to which these granules will belong.", | ||
"anyOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"$ref": "#/definitions/collection" | ||
} | ||
] | ||
}, | ||
"provider": { | ||
"description": "the name of the provider (e.g. SIP, SDS, etc. ) producing these files.", | ||
"type": "string" | ||
}, | ||
"trace": { | ||
"description": "Information on the message or who is sending it.", | ||
"type": "string" | ||
}, | ||
"response": { | ||
"description": "The response message type sent. Can be a success message or error message. Akin to both the PAN and PDRD", | ||
"type": "object", | ||
"properties": { | ||
"status": { | ||
"description": "Successful or error.", | ||
"type": "string", | ||
"enum": [ | ||
"SUCCESS", | ||
"FAILURE" | ||
] | ||
}, | ||
"ingestionMetadata": { | ||
"description": "Object defining ingestion metadata, like CMR Concept IDs, URLS, etc", | ||
"type": "object", | ||
"properties": { | ||
"catalogId": { | ||
"description": "Identifier for catalog", | ||
"type": "string" | ||
}, | ||
"catalogUrl": { | ||
"description": "URL of catalog entry", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"errorCode": { | ||
"description": "Error message. Success messages can be ignored.", | ||
"type": "string", | ||
"enum": [ | ||
"VALIDATION_ERROR", | ||
"PROCESSING_ERROR", | ||
"TRANSFER_ERROR" | ||
] | ||
}, | ||
"errorMessage": { | ||
"description": "The message error for the failure that occured.", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"status" | ||
] | ||
}, | ||
"product": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "Identifier/name of the product", | ||
"type": "string" | ||
}, | ||
"dataVersion": { | ||
"description": "Version of this product", | ||
"type": "string" | ||
}, | ||
"dataProcessingType": { | ||
"description": "The type of data processing stream that generated the product", | ||
"type": "string", | ||
"enum": [ | ||
"forward", | ||
"reprocessing" | ||
] | ||
}, | ||
"files": { | ||
"description": "array of files that make up this product", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/file" | ||
} | ||
}, | ||
"filegroups": { | ||
"description": "array of filegroups that make up this product", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/filegroup" | ||
} | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"name", | ||
"files" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"name", | ||
"filegroups" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"version", | ||
"submissionTime", | ||
"collection", | ||
"identifier", | ||
"product" | ||
], | ||
"not": { | ||
"required": [ | ||
"response" | ||
] | ||
} | ||
}, | ||
{ | ||
"required": [ | ||
"version", | ||
"receivedTime", | ||
"processCompleteTime", | ||
"submissionTime", | ||
"identifier", | ||
"collection", | ||
"response" | ||
] | ||
} | ||
] | ||
} |
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.
May want to insert a validation of the config file? I'm not sure it's necessary, though, because there could be lots of stuff in the config file that we don't care about when we're just validating the json? https://github.com/nsidc/granule-metgen/blob/main/src/nsidc/metgen/cli.py#L54
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.
My take on the story is that we're focused on validating JSON output in the issue-41 feature, not other things that do in fact need to be validated. I'm inclined to stick with the current setup. What I feel would be better, config-file-wise, is to add the equivalent of
config.validate(configuration)
to the CLIinit
processing so that the new.ini
file is immediately checked for errors.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.
I'm good with that