-
-
Notifications
You must be signed in to change notification settings - Fork 13
Serial flag python #430
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
base: main
Are you sure you want to change the base?
Serial flag python #430
Conversation
There is an error in CI:
|
I'll work on this now. I pushed too soon! |
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.
schema/check_schemas.py
Outdated
num_processors = multiprocessing.cpu_count() | ||
logging.info('Schema validation: %s processors for %s schema validations', num_processors, len(file_names)) | ||
def validate_all_schema(validator, file_names): | ||
if not validator.options.run_serial: |
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.
flip the "then" and "else" branches so that you can avoid using not
in your condition test.
schema/check_test_output.py
Outdated
|
||
# file_base + output_path | ||
test_output_path = schema_options.schema_base | ||
print('!!! TEST OUTPUT PATH %s' % (test_output_path)) |
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 print
s. only logging, and if necessary
schema/schema_validator.py
Outdated
@@ -129,8 +127,13 @@ def validate_test_data_with_schema(self): | |||
|
|||
# Check for all the possible files | |||
json_file_pattern = os.path.join(self.test_data_base, '*', '*.json') | |||
logging.info('JSON FILE_PATTERN: %s', json_file_pattern); |
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.
for here and elsewhere (above & below): change log level to debug if this is not useful to see in a log file (ex: looking at a CI run)
schema/schema_validator.py
Outdated
result = p.map(self.check_test_data_against_schema, schema_test_data) | ||
return result | ||
def check_all_test_data_schema(self, schema_test_data): | ||
if not self.run_serial: |
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.
ditto
schema/schema_validator.py
Outdated
for test_data in schema_test_data: | ||
results.append(self.check_test_data_against_schema(test_data)) |
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.
could turn the instantiation + initialization of results
into a FP-style map
. Not sure how Python does that.
schema/schema_validator.py
Outdated
return results, test_validation_plans | ||
else: | ||
logging.info('JSON test output serially validation on %s files!', len(test_validation_plans)) | ||
for test_data in test_validation_plans: |
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.
ditto. also, does results
need to be initialized before you call .append
on it?
schema/schema_validator.py
Outdated
num_processors = mp.cpu_count() | ||
logging.info('JSON test output validation: %s processors for %s plans', num_processors, | ||
len(test_validation_plans)) | ||
if not self.run_serial: |
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.
ditto
pass | ||
|
||
if test_data_files_not_found: | ||
logging.info('Note: %d potential test data sets were not found.', len(test_data_files_not_found)) | ||
|
||
results = self.parallel_check_test_data_schema(schema_test_info) | ||
results = self.check_all_test_data_schema(schema_test_info) | ||
|
||
for result_data in results: |
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 replace the instantiation, for loop, and if with an FP-style map
+ filter
.
#386