-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove NB scripts, introduce distributed RunTests (#102)
* all steps and launcher are ready * introduce dimi, refactor dependencies * wip introducing dimi * introduce dimi * everything except template is ready * gui for running tests * remove two-phase and rollback * run tests button * almost working * fix work splitup * fully working runtests * report table and filterset * remove old scripts * delete scripts migration * api for running tests * fix log debug * netbox version compatibility * final tests * disable fail fast * add system levels * backports to support 3.7 * stop running tests for 3.6 * page-header -> header * remove unneeded template parts * adjust runtests template
- Loading branch information
1 parent
ef15f08
commit 8af6b64
Showing
76 changed files
with
2,223 additions
and
739 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
DEBUG=$1 | ||
shift | ||
|
||
if [[ $DEBUG == 1 ]]; then | ||
echo "!!! DEBUGGING IS ENABLED !!!" | ||
python -m debugpy --listen 0.0.0.0:5678 $@ | ||
else | ||
python $@ | ||
fi |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from typing import Annotated | ||
|
||
import django_rq | ||
from dimi.scopes import Singleton | ||
from django.conf import LazySettings, settings | ||
from utilities.rqworker import get_workers_for_queue | ||
|
||
from validity import di | ||
from validity.choices import ConnectionTypeChoices | ||
from validity.pollers import NetmikoPoller, RequestsPoller, ScrapliNetconfPoller | ||
from validity.settings import ValiditySettings | ||
from validity.utils.misc import null_request | ||
|
||
|
||
@di.dependency | ||
def django_settings(): | ||
return settings | ||
|
||
|
||
@di.dependency(scope=Singleton) | ||
def validity_settings(django_settings: Annotated[LazySettings, django_settings]): | ||
return ValiditySettings.model_validate(django_settings.PLUGINS_CONFIG.get("validity", {})) | ||
|
||
|
||
@di.dependency(scope=Singleton) | ||
def poller_map(): | ||
return { | ||
ConnectionTypeChoices.netmiko: NetmikoPoller, | ||
ConnectionTypeChoices.requests: RequestsPoller, | ||
ConnectionTypeChoices.scrapli_netconf: ScrapliNetconfPoller, | ||
} | ||
|
||
|
||
from validity.scripts import ApplyWorker, CombineWorker, Launcher, SplitWorker, Task # noqa | ||
|
||
|
||
@di.dependency | ||
def runtests_worker_count(vsettings: Annotated[ValiditySettings, validity_settings]) -> int: | ||
return get_workers_for_queue(vsettings.runtests_queue) | ||
|
||
|
||
@di.dependency(scope=Singleton) | ||
def runtests_launcher( | ||
vsettings: Annotated[ValiditySettings, validity_settings], | ||
split_worker: Annotated[SplitWorker, ...], | ||
apply_worker: Annotated[ApplyWorker, ...], | ||
combine_worker: Annotated[CombineWorker, ...], | ||
): | ||
from validity.models import ComplianceReport | ||
|
||
return Launcher( | ||
job_name="RunTests", | ||
job_object_factory=null_request()(ComplianceReport.objects.create), | ||
rq_queue=django_rq.get_queue(vsettings.runtests_queue), | ||
tasks=[ | ||
Task(split_worker, job_timeout=vsettings.script_timeouts.runtests_split), | ||
Task( | ||
apply_worker, | ||
job_timeout=vsettings.script_timeouts.runtests_apply, | ||
multi_workers=True, | ||
), | ||
Task(combine_worker, job_timeout=vsettings.script_timeouts.runtests_combine), | ||
], | ||
) |
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
Oops, something went wrong.