HEPCloud / decisionengine

HEPCloud Decision Engine framework
Apache License 2.0
6 stars 25 forks source link

Add Countdown class to address global timeout problem #636

Closed knoepfel closed 2 years ago

knoepfel commented 2 years ago

The DE can be configured to shutdown hard after a specified time period has elapsed (default is 10 seconds). Unfortunately, this timeout was applied for each channel and source process, resulting in a wait of '(# channels) 10 + (# sources) 10' seconds.

This commit introduces a Countdown class which keeps track of the elapsed time, enabling a global timeout (10 seconds, by default) that is close to what the operator would expect.

codecov[bot] commented 2 years ago

Codecov Report

Merging #636 (0c45941) into master (4c458e0) will increase coverage by 0.63%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #636      +/-   ##
==========================================
+ Coverage   96.63%   97.26%   +0.63%     
==========================================
  Files          48       49       +1     
  Lines        2853     2889      +36     
  Branches      385      460      +75     
==========================================
+ Hits         2757     2810      +53     
+ Misses         61       53       -8     
+ Partials       35       26       -9     
Flag Coverage Δ
python-3.10 96.98% <96.42%> (?)
python-3.6 96.73% <96.42%> (+0.09%) :arrow_up:

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

Impacted Files Coverage Δ
.../decisionengine/framework/engine/DecisionEngine.py 92.13% <100.00%> (+0.48%) :arrow_up:
...c/decisionengine/framework/engine/SourceWorkers.py 100.00% <100.00%> (ø)
src/decisionengine/framework/util/countdown.py 100.00% <100.00%> (ø)
src/decisionengine/framework/modules/Transform.py 100.00% <0.00%> (ø)
...ionengine/framework/taskmanager/ProcessingState.py 100.00% <0.00%> (ø)
...rc/decisionengine/framework/dataspace/dataspace.py 93.97% <0.00%> (+0.07%) :arrow_up:
...aspace/datasources/sqlalchemy_ds/datasource_api.py 100.00% <0.00%> (+1.22%) :arrow_up:
.../decisionengine/framework/engine/ChannelWorkers.py 90.78% <0.00%> (+2.63%) :arrow_up:
src/decisionengine/framework/dataspace/maintain.py 100.00% <0.00%> (+3.96%) :arrow_up:
... and 2 more

Continue to review full report at Codecov.

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