primitive 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
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/__about__.py +1 -1
- primitive/agent/actions.py +52 -40
- {primitive-0.1.6.dist-info → primitive-0.1.8.dist-info}/METADATA +1 -1
- {primitive-0.1.6.dist-info → primitive-0.1.8.dist-info}/RECORD +7 -7
- {primitive-0.1.6.dist-info → primitive-0.1.8.dist-info}/WHEEL +0 -0
- {primitive-0.1.6.dist-info → primitive-0.1.8.dist-info}/entry_points.txt +0 -0
- {primitive-0.1.6.dist-info → primitive-0.1.8.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/actions.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
import sys
|
1
2
|
from time import sleep
|
2
3
|
from primitive.utils.actions import BaseAction
|
3
4
|
from loguru import logger
|
5
|
+
from primitive.__about__ import __version__
|
4
6
|
|
5
7
|
|
6
8
|
class Agent(BaseAction):
|
@@ -8,52 +10,62 @@ class Agent(BaseAction):
|
|
8
10
|
self,
|
9
11
|
):
|
10
12
|
logger.enable("primitive")
|
11
|
-
logger.
|
12
|
-
|
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
|
13
|
+
logger.info(" [*] primitive")
|
14
|
+
logger.info(f" [*] Version: {__version__}")
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
)
|
16
|
+
# self.primitive.hardware.update_hardware_system_info()
|
17
|
+
self.primitive.hardware.check_in_http()
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
try:
|
20
|
+
while True:
|
21
|
+
hardware = self.primitive.hardware.get_own_hardware_details()
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
35
30
|
|
36
|
-
|
37
|
-
|
31
|
+
job_runs_data = self.primitive.projects.get_job_runs(
|
32
|
+
status="pending", first=1, reservation_id=active_reservation_id
|
33
|
+
)
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
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")
|
42
46
|
|
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
47
|
self.primitive.projects.job_run_update(
|
53
|
-
job_run["id"],
|
54
|
-
status="request_completed",
|
55
|
-
conclusion="failure",
|
56
|
-
stdout=message,
|
48
|
+
job_run["id"], status="request_completed"
|
57
49
|
)
|
58
50
|
|
59
|
-
|
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,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
|
@@ -1,8 +1,8 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=l6ubjyuvmUH9lyfEXisRpcZSgR7U_FgedajzCgD-aBk,128
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=LXSpPtqQLxkOXsnsbs4UN3n7G_pHCz8AkBFCrk7Is4g,1796
|
4
4
|
primitive/client.py,sha256=3RMRNY4ZiGT2OKnZtquWyrXjRSgDe5HlZvtFNKZErLQ,2083
|
5
|
-
primitive/agent/actions.py,sha256=
|
5
|
+
primitive/agent/actions.py,sha256=v-tw3RGJpQ94qKivq-bT4gGt7CPShBkZgrNbSqXzEKk,2725
|
6
6
|
primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
|
7
7
|
primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
primitive/auth/actions.py,sha256=N2bGcwXNsB89pzs66gF9A5_WzUScY5fhfOyWixqo2y8,1054
|
@@ -27,8 +27,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
|
|
27
27
|
primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
|
28
28
|
primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
|
29
29
|
primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
|
30
|
-
primitive-0.1.
|
31
|
-
primitive-0.1.
|
32
|
-
primitive-0.1.
|
33
|
-
primitive-0.1.
|
34
|
-
primitive-0.1.
|
30
|
+
primitive-0.1.8.dist-info/METADATA,sha256=_uCUmPAki37BqYNtl1UcotllOnWXmI4KrJFu0JZp5_w,1817
|
31
|
+
primitive-0.1.8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
32
|
+
primitive-0.1.8.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
33
|
+
primitive-0.1.8.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
34
|
+
primitive-0.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|