Skip to content

Conversation

benank
Copy link
Contributor

@benank benank commented Jun 22, 2022

Adds an AssessmentState.json file with details about when the last assessment ran. Also includes a 6 hour minimum delay between auto assessment runs.

@benank benank changed the title [WIP] Add AssessmentState file and max auto assessment interval [DRAFT] Add AssessmentState file and max auto assessment interval Jun 22, 2022
@benank benank changed the title [DRAFT] Add AssessmentState file and max auto assessment interval Add AssessmentState file and max auto assessment interval Jun 22, 2022
@benank benank requested a review from rane-rajasi June 22, 2022 17:37
@codecov
Copy link

codecov bot commented Jun 22, 2022

Codecov Report

Merging #150 (05bc000) into master (53dcb88) will increase coverage by 0.14%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   88.01%   88.15%   +0.14%     
==========================================
  Files          86       86              
  Lines       12084    12227     +143     
==========================================
+ Hits        10636    10779     +143     
  Misses       1448     1448              
Flag Coverage Δ
python27 86.63% <100.00%> (+0.22%) ⬆️
python39 88.12% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/core/src/bootstrap/Constants.py 98.34% <100.00%> (+0.01%) ⬆️
src/core/src/core_logic/PatchAssessor.py 99.30% <100.00%> (+0.91%) ⬆️
src/core/tests/Test_PatchAssessor.py 99.03% <100.00%> (+1.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

assessment_state = self.runtime.patch_assessor.read_assessment_state()
with open(self.runtime.patch_assessor.assessment_state_file_path, 'r') as file_handle:
assessment_state_from_file = json.loads(file_handle.read())["assessmentState"]
self.assessment_state_equals(assessment_state, assessment_state_from_file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to validate write_assessment_state(), updated an existing AssessmentState.json will be to compare the lastHeartbeat before and after write_assessment_state(), i.e:

  • Read AssessmentState before line 79 i.e. before write_assessment_state()
  • Call write_assessment_state()
  • Read the file
  • compare lastHeartbeat between step 1 and 3, should not be the same

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ben is aware of what to do here. Ack

@benank benank merged commit cd20715 into master Aug 24, 2022
@benank benank deleted the bankiel-assessment-state-f branch August 24, 2022 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants