Skip to content

Script Status Improvements #2035

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Script Status Improvements #2035

wants to merge 5 commits into from

Conversation

ryanmelt
Copy link
Member

Still needs:
Python changes
Updates to Running/Completed Script Display
Minor updates to backend apis (for pagination)
Minor updates to script apis (for pagination)
ScriptRunner restore running script
ScriptRunner emit running script id on start

@ryanmelt ryanmelt requested a review from jmthomas April 22, 2025 01:01
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.35%. Comparing base (805f3b0) to head (698170a).

Files with missing lines Patch % Lines
openc3/lib/openc3/models/model.rb 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2035      +/-   ##
==========================================
+ Coverage   76.87%   78.35%   +1.48%     
==========================================
  Files         638      618      -20     
  Lines       47462    46104    -1358     
  Branches      754      754              
==========================================
- Hits        36486    36125     -361     
+ Misses      10893     9896     -997     
  Partials       83       83              
Flag Coverage Δ
python 83.99% <ø> (ø)
ruby-api 57.93% <ø> (+9.62%) ⬆️
ruby-backend 82.86% <75.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

# Also need to cleanup the status model in this case because the process will not die and cleanup
running_script.state = "killed"
running_script.update
end
Copy link
Member

Choose a reason for hiding this comment

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

Were we just leaving zombie processes before with the RunningScript.delete by itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

Potentially. Though most of the time I think they were not really there due to a container restart.

@@ -343,18 +302,42 @@ def self.spawn(scope, name, suite_runner = nil, disconnect = false, environment
model = OpenC3::OfflineAccessModel.get_model(name: username, scope: scope) if username and username != ''
Copy link
Member

Choose a reason for hiding this comment

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

Don't need the if username check anymore because you're always setting it to Anonymous above if it's not set

Copy link
Member Author

Choose a reason for hiding this comment

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

Will change to check for not Anonymous.

updated_at: nil, # Set by create/update - ISO format
scope: scope # Scope of the script
)
script_status.create(isoformat: true)
Copy link
Member

Choose a reason for hiding this comment

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

Love the docs here!
What is the point of the (*) after the comments?

Copy link
Member Author

Choose a reason for hiding this comment

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

The * was just notes to myself on which items to make sure get updated while running. Will remove.

# Capture STDOUT and STDERR
$stdout.add_stream(@output_io)
$stderr.add_stream(@output_io)
end
Copy link
Member

Choose a reason for hiding this comment

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

How does this just go away?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're always running so this was dead code.

end

def is_complete?
return (@state == 'complete' or @state == 'complete_errors' or @state == 'stopped' or @state == 'crash' or @state == 'killed')
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between complete and stopped?

Copy link
Member Author

Choose a reason for hiding this comment

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

complete = got all the way through the script without errors
stopped = stopped prematurely

undeploy()
self.class.store.hdel(@primary_key, @name)
# Also remove from ordered set
self.class.store.zremrangebyscore(@primary_key + "__LIST", @name.to_f - 0.1, @name.to_f + 0.1)
Copy link
Member

Choose a reason for hiding this comment

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

@name is the PID? Isn't this an integer? Do you have to do the +- 0.1 or does it work with just the @name.to_i?

Copy link
Member Author

Choose a reason for hiding this comment

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

Name is the script id not PID.
Redis store values are floats, so I figured it would safer with the range rather than exact match.

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