Skip to content

Timeout capesandbox analyzer#1947

Merged
0ssigeno merged 15 commits intodevelopfrom
timeout-capesandbox-analyzer
Oct 25, 2023
Merged

Timeout capesandbox analyzer#1947
0ssigeno merged 15 commits intodevelopfrom
timeout-capesandbox-analyzer

Conversation

@federicofantini
Copy link
Contributor

Description

added timeout on every request of capesandbox analyzer + start the poll for result after the analysis is ended

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist

  • I have read and understood the rules about how to Contribute to this project
  • The pull request is for the branch develop
  • A new plugin (analyzer, connector, visualizer, playbook or ingestor) was added or changed, in which case:
    • Usage file was updated.
    • Advanced-Usage was updated (in case the plugin provides additional optional configuration).
    • If the plugin requires mocked testing, _monkeypatch() was used in its class to apply the necessary decorators.
    • If a File analyzer was added and it supports a mimetype which is not already supported, you added a sample of that type inside the archive test_files.zip and you added the default tests for that mimetype in test_classes.py.
    • If you created a new analyzer and it is free (does not require API keys), please add it in the FREE_TO_USE_ANALYZERS playbook in playbook_config.json.
    • Check if it could make sense to add that analyzer/connector to other freely available playbooks.
    • I have provided the resulting raw JSON of a finished analysis and a screenshot of the results.
  • If external libraries/packages with restrictive licenses were used, they were added in the Legal Notice section.
  • Linters (Black, Flake, Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved (see tests folder). All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.

Copy link
Contributor

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Looks good. Worth considering though. View full project report here.

Comment on lines 210 to 214
logger.info(
f"Job: {self.job_id} ->"
f"Sleeping for the entire duration of the analysis: {self.timeout}s"
)
time.sleep(self.timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible for cape to end the analysis before timeout ? If it is not possible, cool, this works; if it is, this will wait the maximum time possible in any case

Copy link
Contributor

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Looks good. Worth considering though. View full project report here.

Copy link
Contributor

@0ssigeno 0ssigeno left a comment

Choose a reason for hiding this comment

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

lgtm, just fix the migration file (you just need to change the number and its dependency to the latest in develop)

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #1947 (f87b936) into develop (cbdaff1) will increase coverage by 0.34%.
Report is 33 commits behind head on develop.
The diff coverage is 52.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1947      +/-   ##
===========================================
+ Coverage    75.68%   76.03%   +0.34%     
===========================================
  Files          438      446       +8     
  Lines        13442    13684     +242     
  Branches      1406     1434      +28     
===========================================
+ Hits         10174    10404     +230     
- Misses        2704     2705       +1     
- Partials       564      575      +11     
Files Coverage Δ
.../0046_analyzerconfig_add_requests_timeout_field.py 57.14% <57.14%> (ø)
...p/analyzers_manager/file_analyzers/cape_sandbox.py 62.23% <48.93%> (-0.36%) ⬇️

... and 46 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbdaff1...f87b936. Read the comment docs.

@0ssigeno 0ssigeno merged commit 2713452 into develop Oct 25, 2023
@0ssigeno 0ssigeno deleted the timeout-capesandbox-analyzer branch October 25, 2023 12:36
@federicofantini federicofantini restored the timeout-capesandbox-analyzer branch October 25, 2023 13:02
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.

2 participants