This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
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
Move the check from star_scan command handler to start_pending_scans(). This is because the new scans are not rejected anymore, but will not be started if the max_scans value was reached or if there is no enough free memory.
Also, replace the error raise for a debug log message.
Receive the directory path where the picked scan info will be stored. Initialize the ScanCollection() with this path.
Only the minimal information is stored. Other information is prepared in a dictionary to be pickled later. The credentials are taken from the target dictionary and stored in the scan_table. This prevent to pickle sensitive information. Storing credentials does not have big impact in the memory usage.
Call the new method from create_scan()
The info is stored in the corresponding slot in the scan_table Call the method to unpickle from start_scan(). The file will be deleted.
Removes the file with the pickled scan_info and set the scan status to STOPPED. This allows the client to delete the scan
Codecov Report
@@ Coverage Diff @@
## master #278 +/- ##
==========================================
+ Coverage 74.57% 74.92% +0.35%
==========================================
Files 21 22 +1
Lines 2332 2469 +137
==========================================
+ Hits 1739 1850 +111
- Misses 593 619 +26
Continue to review full report at Codecov.
|
jjnicola
force-pushed
the
queue
branch
2 times, most recently
from
May 29, 2020 09:57
c6b468e
to
d232623
Compare
If there is no enough memory, the scan is kept in the queue. A minimum free memory value in MB must be given as option, otherwise no free memory check will be performed.
This will remove the pickled scan info files.
If the max is reached, the next scans are rejected.
bjoernricks
suggested changes
Jun 4, 2020
Instead use a method wrapper to perform the file clean up.
Also, remove the file before raising an error when the unpickling fails.
bjoernricks
suggested changes
Jun 4, 2020
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.
Just some additional type hints. Afterwards it is ready to be merged.
bjoernricks
approved these changes
Jun 4, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.