Skip to content
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

Spawn reactive runner #8

Merged
merged 21 commits into from
Sep 19, 2024
Merged

Spawn reactive runner #8

merged 21 commits into from
Sep 19, 2024

Conversation

cbartz
Copy link
Collaborator

@cbartz cbartz commented Sep 11, 2024

Applicable spec: ISD-116

Overview

Spawn a reactive runner after consuming a message from the queue.

This PR only adds the logic of spawning a reactive runner (and cleaning up at the next reconciliation).

Subsequent PRs are planned to include label validation and running the script under a separate user.

Successful integration test run on github-runner-operator: https://github.com/canonical/github-runner-operator/actions/runs/10920989028/job/30314702314

Rationale

In order to implement reactive scheduling, we need to spawn runners.

Module Changes

(skipped the github_runner_manager package name prefix)

New modules:

  • reactive.types_: Contains the configuration object that is passed to the script to spawn a runner.

Library/Dependency Changes

Checklist

  • The contributing guide was applied
  • The documentation is generated using src-docs
  • The PR is tagged with appropriate label (urgent, trivial, complex)
  • The library version in pyproject.toml is incremented

@cbartz cbartz added the complex label Sep 11, 2024
Copy link

@jdkandersson jdkandersson 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 to me

@cbartz cbartz changed the title WIP - Spawn reactive runner Spawn reactive runner Sep 18, 2024
Copy link
Collaborator Author

@cbartz cbartz left a comment

Choose a reason for hiding this comment

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

Comments to support the PR review.

src-docs/types_.general.md Outdated Show resolved Hide resolved
@cbartz cbartz marked this pull request as ready for review September 18, 2024 12:34
@cbartz cbartz requested a review from a team as a code owner September 18, 2024 12:34
Copy link

Test coverage for d72fa72

Name                                                         Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------------------------------------------
src/github_runner_manager/__init__.py                            0      0      0      0   100%
src/github_runner_manager/errors.py                             22      0      0      0   100%
src/github_runner_manager/github_client.py                      91     34     34      2    52%   65-72, 100-135, 148-157, 171-180, 191-198, 222->242, 236
src/github_runner_manager/manager/__init__.py                    0      0      0      0   100%
src/github_runner_manager/manager/cloud_runner_manager.py       61      0      6      0   100%
src/github_runner_manager/manager/github_runner_manager.py      17      0      6      0   100%
src/github_runner_manager/manager/runner_manager.py            135     34     48      5    70%   175, 187, 191, 207-212, 230-231, 268-284, 298-305, 325-329, 338
src/github_runner_manager/manager/runner_scaler.py             106     11     38      3    89%   128-129, 143-144, 149, 155, 249-250, 262-264
src/github_runner_manager/metrics/__init__.py                    0      0      0      0   100%
src/github_runner_manager/metrics/events.py                     55      2      8      1    95%   56->59, 166-167
src/github_runner_manager/metrics/github.py                     16      0      0      0   100%
src/github_runner_manager/metrics/runner.py                    144     10     32      3    91%   164, 190-203, 239, 276, 458-459
src/github_runner_manager/metrics/runner_logs.py                24      5      4      1    79%   30-33, 47->46, 51-52
src/github_runner_manager/metrics/storage.py                    70      8     12      0    90%   89-90, 117-118, 182-183, 189-190
src/github_runner_manager/metrics/type.py                        5      0      0      0   100%
src/github_runner_manager/openstack_cloud/__init__.py           26      0      2      0   100%
src/github_runner_manager/reactive/__init__.py                   0      0      0      0   100%
src/github_runner_manager/reactive/consumer.py                  75      4     14      1    94%   129-130, 202-205
src/github_runner_manager/reactive/runner.py                    24     24      4      0     0%   6-56
src/github_runner_manager/reactive/runner_manager.py            53      0     14      1    99%   102->exit
src/github_runner_manager/reactive/types_.py                    11      0      0      0   100%
src/github_runner_manager/types_/__init__.py                    31      8      4      1    69%   29-42, 62, 70
src/github_runner_manager/types_/github.py                      80      9     10      0    83%   208, 229, 250-257
src/github_runner_manager/utilities.py                          46     28     14      0    30%   73-100, 127-145, 157-158
--------------------------------------------------------------------------------------------------------
TOTAL                                                         1092    177    250     18    80%

Static code analysis report

Run started:2024-09-19 07:15:37.390699

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 3890
  Total lines skipped (#nosec): 2
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 3

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Copy link

@yhaliaw yhaliaw left a comment

Choose a reason for hiding this comment

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

Minor comment on formatting of a code comment.

src/github_runner_manager/github_client.py Show resolved Hide resolved
src/github_runner_manager/github_client.py Show resolved Hide resolved
@cbartz cbartz merged commit e53ed35 into main Sep 19, 2024
10 checks passed
@cbartz cbartz deleted the feat/reactive-spawning branch September 19, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants