primitive 0.1.6__tar.gz → 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {primitive-0.1.6 → primitive-0.1.8}/PKG-INFO +1 -1
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/__about__.py +1 -1
- primitive-0.1.8/src/primitive/agent/actions.py +71 -0
- primitive-0.1.6/src/primitive/agent/actions.py +0 -59
- {primitive-0.1.6 → primitive-0.1.8}/.git-hooks/pre-commit +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/.gitattributes +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/.github/workflows/lint.yml +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/.github/workflows/publish.yml +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/.gitignore +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/.vscode/settings.json +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/LICENSE.txt +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/Makefile +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/README.md +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/linux setup.md +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/pyproject.toml +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/requirements.txt +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/__init__.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/agent/commands.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/auth/__init__.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/auth/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/auth/commands.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/cli.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/client.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/files/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/files/commands.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/graphql/__init__.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/graphql/sdk.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/hardware/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/hardware/commands.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/lint/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/lint/commands.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/projects/__init__.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/projects/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/simulations/__init__.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/simulations/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/actions.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/config.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/files.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/git.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/memory_size.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/printer.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/shell.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/src/primitive/utils/verible.py +0 -0
- {primitive-0.1.6 → primitive-0.1.8}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
4
4
|
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
5
|
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
6
|
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import sys
|
2
|
+
from time import sleep
|
3
|
+
from primitive.utils.actions import BaseAction
|
4
|
+
from loguru import logger
|
5
|
+
from primitive.__about__ import __version__
|
6
|
+
|
7
|
+
|
8
|
+
class Agent(BaseAction):
|
9
|
+
def execute(
|
10
|
+
self,
|
11
|
+
):
|
12
|
+
logger.enable("primitive")
|
13
|
+
logger.info(" [*] primitive")
|
14
|
+
logger.info(f" [*] Version: {__version__}")
|
15
|
+
|
16
|
+
# self.primitive.hardware.update_hardware_system_info()
|
17
|
+
self.primitive.hardware.check_in_http()
|
18
|
+
|
19
|
+
try:
|
20
|
+
while True:
|
21
|
+
hardware = self.primitive.hardware.get_own_hardware_details()
|
22
|
+
|
23
|
+
active_reservation_id = None
|
24
|
+
if hardware.get("activeReservation"):
|
25
|
+
active_reservation_id = hardware["activeReservation"]["id"]
|
26
|
+
if not active_reservation_id:
|
27
|
+
logger.debug("No active reservation found")
|
28
|
+
sleep(5)
|
29
|
+
continue
|
30
|
+
|
31
|
+
job_runs_data = self.primitive.projects.get_job_runs(
|
32
|
+
status="pending", first=1, reservation_id=active_reservation_id
|
33
|
+
)
|
34
|
+
|
35
|
+
pending_job_runs = [
|
36
|
+
edge["node"] for edge in job_runs_data["jobRuns"]["edges"]
|
37
|
+
]
|
38
|
+
|
39
|
+
for job_run in pending_job_runs:
|
40
|
+
logger.debug("Found pending Job Run")
|
41
|
+
logger.debug(f"Job Run ID: {job_run['id']}")
|
42
|
+
logger.debug(f"Job Name: {job_run['job']['name']}")
|
43
|
+
|
44
|
+
if job_run["job"]["slug"] == "lint":
|
45
|
+
logger.debug("Executing Lint Job")
|
46
|
+
|
47
|
+
self.primitive.projects.job_run_update(
|
48
|
+
job_run["id"], status="request_completed"
|
49
|
+
)
|
50
|
+
|
51
|
+
result, message = self.primitive.lint.execute()
|
52
|
+
if result:
|
53
|
+
self.primitive.projects.job_run_update(
|
54
|
+
job_run["id"],
|
55
|
+
status="request_completed",
|
56
|
+
conclusion="success",
|
57
|
+
stdout=message,
|
58
|
+
)
|
59
|
+
else:
|
60
|
+
self.primitive.projects.job_run_update(
|
61
|
+
job_run["id"],
|
62
|
+
status="request_completed",
|
63
|
+
conclusion="failure",
|
64
|
+
stdout=message,
|
65
|
+
)
|
66
|
+
|
67
|
+
sleep(5)
|
68
|
+
except KeyboardInterrupt:
|
69
|
+
logger.info(" [*] Stopping primitive...")
|
70
|
+
self.primitive.hardware.check_in_http(is_available=False, is_online=False)
|
71
|
+
sys.exit()
|
@@ -1,59 +0,0 @@
|
|
1
|
-
from time import sleep
|
2
|
-
from primitive.utils.actions import BaseAction
|
3
|
-
from loguru import logger
|
4
|
-
|
5
|
-
|
6
|
-
class Agent(BaseAction):
|
7
|
-
def execute(
|
8
|
-
self,
|
9
|
-
):
|
10
|
-
logger.enable("primitive")
|
11
|
-
logger.debug("Starting Primitive Agent")
|
12
|
-
while True:
|
13
|
-
hardware = self.primitive.hardware.get_own_hardware_details()
|
14
|
-
|
15
|
-
active_reservation_id = None
|
16
|
-
if hardware.get("activeReservation"):
|
17
|
-
active_reservation_id = hardware["activeReservation"]["id"]
|
18
|
-
if not active_reservation_id:
|
19
|
-
logger.debug("No active reservation found")
|
20
|
-
sleep(5)
|
21
|
-
continue
|
22
|
-
|
23
|
-
job_runs_data = self.primitive.projects.get_job_runs(
|
24
|
-
status="pending", first=1, reservation_id=active_reservation_id
|
25
|
-
)
|
26
|
-
|
27
|
-
pending_job_runs = [
|
28
|
-
edge["node"] for edge in job_runs_data["jobRuns"]["edges"]
|
29
|
-
]
|
30
|
-
|
31
|
-
for job_run in pending_job_runs:
|
32
|
-
logger.debug("Found pending Job Run")
|
33
|
-
logger.debug(f"Job Run ID: {job_run['id']}")
|
34
|
-
logger.debug(f"Job Name: {job_run['job']['name']}")
|
35
|
-
|
36
|
-
if job_run["job"]["slug"] == "lint":
|
37
|
-
logger.debug("Executing Lint Job")
|
38
|
-
|
39
|
-
self.primitive.projects.job_run_update(
|
40
|
-
job_run["id"], status="request_completed"
|
41
|
-
)
|
42
|
-
|
43
|
-
result, message = self.primitive.lint.execute()
|
44
|
-
if result:
|
45
|
-
self.primitive.projects.job_run_update(
|
46
|
-
job_run["id"],
|
47
|
-
status="request_completed",
|
48
|
-
conclusion="success",
|
49
|
-
stdout=message,
|
50
|
-
)
|
51
|
-
else:
|
52
|
-
self.primitive.projects.job_run_update(
|
53
|
-
job_run["id"],
|
54
|
-
status="request_completed",
|
55
|
-
conclusion="failure",
|
56
|
-
stdout=message,
|
57
|
-
)
|
58
|
-
|
59
|
-
sleep(5)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|