primitive 0.1.20__tar.gz → 0.1.22__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.
Files changed (57) hide show
  1. {primitive-0.1.20 → primitive-0.1.22}/PKG-INFO +1 -1
  2. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/__about__.py +1 -1
  3. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/agent/actions.py +49 -12
  4. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/hardware/actions.py +4 -0
  5. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/jobs/actions.py +1 -0
  6. {primitive-0.1.20 → primitive-0.1.22}/.git-hooks/pre-commit +0 -0
  7. {primitive-0.1.20 → primitive-0.1.22}/.gitattributes +0 -0
  8. {primitive-0.1.20 → primitive-0.1.22}/.github/workflows/lint.yml +0 -0
  9. {primitive-0.1.20 → primitive-0.1.22}/.github/workflows/publish.yml +0 -0
  10. {primitive-0.1.20 → primitive-0.1.22}/.gitignore +0 -0
  11. {primitive-0.1.20 → primitive-0.1.22}/.vscode/settings.json +0 -0
  12. {primitive-0.1.20 → primitive-0.1.22}/LICENSE.txt +0 -0
  13. {primitive-0.1.20 → primitive-0.1.22}/Makefile +0 -0
  14. {primitive-0.1.20 → primitive-0.1.22}/README.md +0 -0
  15. {primitive-0.1.20 → primitive-0.1.22}/linux setup.md +0 -0
  16. {primitive-0.1.20 → primitive-0.1.22}/pyproject.toml +0 -0
  17. {primitive-0.1.20 → primitive-0.1.22}/requirements.txt +0 -0
  18. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/__init__.py +0 -0
  19. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/agent/commands.py +0 -0
  20. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/auth/__init__.py +0 -0
  21. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/auth/actions.py +0 -0
  22. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/auth/commands.py +0 -0
  23. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/cli.py +0 -0
  24. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/client.py +0 -0
  25. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/daemons/actions.py +0 -0
  26. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/daemons/commands.py +0 -0
  27. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/daemons/launch_agents.py +0 -0
  28. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/daemons/launch_service.py +0 -0
  29. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/files/actions.py +0 -0
  30. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/files/commands.py +0 -0
  31. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/git/__init__.py +0 -0
  32. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/git/actions.py +0 -0
  33. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/git/commands.py +0 -0
  34. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/graphql/__init__.py +0 -0
  35. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/graphql/sdk.py +0 -0
  36. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/hardware/commands.py +0 -0
  37. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/jobs/commands.py +0 -0
  38. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/lint/actions.py +0 -0
  39. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/lint/commands.py +0 -0
  40. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/organizations/actions.py +0 -0
  41. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/organizations/commands.py +0 -0
  42. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/projects/__init__.py +0 -0
  43. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/projects/actions.py +0 -0
  44. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/projects/commands.py +0 -0
  45. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/sim/__init__.py +0 -0
  46. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/sim/actions.py +0 -0
  47. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/sim/commands.py +0 -0
  48. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/sim/vcd.py +0 -0
  49. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/actions.py +0 -0
  50. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/config.py +0 -0
  51. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/files.py +0 -0
  52. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/git.py +0 -0
  53. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/memory_size.py +0 -0
  54. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/printer.py +0 -0
  55. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/shell.py +0 -0
  56. {primitive-0.1.20 → primitive-0.1.22}/src/primitive/utils/verible.py +0 -0
  57. {primitive-0.1.20 → primitive-0.1.22}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.20
3
+ Version: 0.1.22
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,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@steins.studio>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.20"
4
+ __version__ = "0.1.22"
@@ -21,15 +21,40 @@ class Agent(BaseAction):
21
21
  sys.exit(1)
22
22
 
23
23
  try:
24
+ active_reservation_id = None
25
+ active_reservation_pk = None
26
+
24
27
  while True:
25
28
  hardware = self.primitive.hardware.get_own_hardware_details()
29
+ if hardware["activeReservation"]:
30
+ if (
31
+ hardware["activeReservation"]["id"] != active_reservation_id
32
+ or hardware["activeReservation"]["pk"] != active_reservation_pk
33
+ ):
34
+ logger.warning("New reservation for this hardware.")
35
+ active_reservation_id = hardware["activeReservation"]["id"]
36
+ active_reservation_pk = hardware["activeReservation"]["pk"]
37
+ logger.debug("Active Reservation:")
38
+ logger.debug(f"Node ID: {active_reservation_id}")
39
+ logger.debug(f"PK: {active_reservation_pk}")
40
+ else:
41
+ if (
42
+ hardware["activeReservation"] is None
43
+ and active_reservation_id is not None
44
+ and hardware["isAvailable"]
45
+ ):
46
+ logger.debug("Previous Reservation is Complete:")
47
+ logger.debug(f"Node ID: {active_reservation_id}")
48
+ logger.debug(f"PK: {active_reservation_pk}")
49
+ active_reservation_id = None
50
+ active_reservation_pk = None
26
51
 
27
- active_reservation_id = None
28
- if hardware.get("activeReservation"):
29
- active_reservation_id = hardware["activeReservation"]["id"]
30
52
  if not active_reservation_id:
31
- logger.debug("No active reservation found")
32
- sleep(5)
53
+ sleep_amount = 5
54
+ logger.debug(
55
+ f"No active reservation found... [sleeping {sleep_amount} seconds]"
56
+ )
57
+ sleep(sleep_amount)
33
58
  continue
34
59
 
35
60
  job_runs_data = self.primitive.jobs.get_job_runs(
@@ -40,6 +65,14 @@ class Agent(BaseAction):
40
65
  edge["node"] for edge in job_runs_data["jobRuns"]["edges"]
41
66
  ]
42
67
 
68
+ if not pending_job_runs:
69
+ sleep_amount = 5
70
+ logger.debug(
71
+ f"Waiting for Job Runs... [sleeping {sleep_amount} seconds]"
72
+ )
73
+ sleep(sleep_amount)
74
+ continue
75
+
43
76
  for job_run in pending_job_runs:
44
77
  logger.debug("Found pending Job Run")
45
78
  logger.debug(f"Job Run ID: {job_run['id']}")
@@ -65,6 +98,14 @@ class Agent(BaseAction):
65
98
  )
66
99
  )
67
100
 
101
+ source_dir = downloaded_git_repository_dir.joinpath(
102
+ job_run["jobSettings"]["rootDirectory"]
103
+ )
104
+
105
+ cmd = ("make",)
106
+ if containerArgs := job_run["jobSettings"]["containerArgs"]:
107
+ cmd = tuple(containerArgs.split(" "))
108
+
68
109
  match job_run["job"]["slug"]:
69
110
  case "lint":
70
111
  logger.debug("Executing Lint Job")
@@ -74,7 +115,7 @@ class Agent(BaseAction):
74
115
  )
75
116
 
76
117
  result, message = self.primitive.lint.execute(
77
- source=downloaded_git_repository_dir
118
+ source=source_dir
78
119
  )
79
120
  if result:
80
121
  conclusion = "success"
@@ -95,17 +136,13 @@ class Agent(BaseAction):
95
136
  job_run["id"], status="request_in_progress"
96
137
  )
97
138
 
98
- cmd = ("make",)
99
- if containerArgs := job_run["jobSettings"]["containerArgs"]:
100
- cmd = tuple(containerArgs.split(" "))
101
-
102
139
  result, message = self.primitive.sim.execute(
103
- source=downloaded_git_repository_dir, cmd=cmd
140
+ source=source_dir, cmd=cmd
104
141
  )
105
142
 
106
143
  # Attempt artifact collection
107
144
  self.primitive.sim.collect_artifacts(
108
- source=downloaded_git_repository_dir,
145
+ source=source_dir,
109
146
  job_run_id=job_run["id"],
110
147
  organization_id=job_run["organization"]["id"],
111
148
  )
@@ -464,6 +464,10 @@ fragment HardwareFragment on Hardware {
464
464
  slug
465
465
  createdAt
466
466
  updatedAt
467
+ isAvailable
468
+ isOnline
469
+ isQuarantined
470
+ isHealthy
467
471
  capabilities {
468
472
  id
469
473
  pk
@@ -131,6 +131,7 @@ fragment JobRunFragment on JobRun {
131
131
  }
132
132
  jobSettings {
133
133
  containerArgs
134
+ rootDirectory
134
135
  }
135
136
  gitCommit {
136
137
  sha
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