primitive 0.1.56__py3-none-any.whl → 0.1.58__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.56"
4
+ __version__ = "0.1.58"
@@ -119,18 +119,23 @@ class Agent(BaseAction):
119
119
  job_run["jobSettings"]["rootDirectory"]
120
120
  )
121
121
 
122
- runner = AgentRunner(
123
- primitive=self.primitive,
124
- source_dir=source_dir,
125
- job_id=job_run["id"],
126
- job_slug=job_run["job"]["slug"],
127
- )
128
-
129
- # Execute job
130
- runner.execute()
131
-
132
- # Clean up
133
- shutil.rmtree(path=downloaded_git_repository_dir)
122
+ try:
123
+ # Initialize Runner
124
+ runner = AgentRunner(
125
+ primitive=self.primitive,
126
+ source_dir=source_dir,
127
+ job_id=job_run["id"],
128
+ job_slug=job_run["job"]["slug"],
129
+ )
130
+ except Exception as e:
131
+ # Log Error
132
+ logger.error(f"Error initializing agent runner: {e}")
133
+ else:
134
+ # Execute job
135
+ runner.execute()
136
+ finally:
137
+ # Clean up
138
+ shutil.rmtree(path=downloaded_git_repository_dir)
134
139
 
135
140
  sleep(5)
136
141
  except KeyboardInterrupt:
primitive/agent/runner.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import yaml
2
- import sys
3
2
  import typing
4
3
  import os
5
4
  import threading
@@ -50,6 +49,7 @@ class AgentRunner:
50
49
  ) -> None:
51
50
  self.primitive = primitive
52
51
  self.source_dir = source_dir
52
+ self.workdir = "."
53
53
  self.job_id = job_id
54
54
  self.job_slug = job_slug
55
55
  self.max_log_size = max_log_size
@@ -71,7 +71,8 @@ class AgentRunner:
71
71
  logger.error(
72
72
  f"Found two job descriptions with the same slug: {self.job_slug}"
73
73
  )
74
- sys.exit(1)
74
+ self.conclude(conclusion="failure")
75
+ raise FileExistsError
75
76
 
76
77
  if yaml_file.exists():
77
78
  self.job = yaml.load(open(yaml_file, "r"), Loader=Loader)
@@ -81,7 +82,8 @@ class AgentRunner:
81
82
  logger.error(
82
83
  f"No job description with matching slug '{self.job_slug}' found"
83
84
  )
84
- sys.exit(1)
85
+ self.conclude(conclusion="failure")
86
+ raise FileNotFoundError
85
87
 
86
88
  logger.info(f"Found job description for {self.job_slug}")
87
89
 
@@ -111,10 +113,14 @@ class AgentRunner:
111
113
  for step in self.steps():
112
114
  logger.info(f"Beginning step {step['name']}")
113
115
 
116
+ # Update workdir
117
+ if "workdir" in step:
118
+ self.workdir = step["workdir"]
119
+
114
120
  # Define step proc
115
121
  proc = Process(
116
122
  cmd=step["cmd"],
117
- workdir=Path(self.source_dir / step["workdir"]),
123
+ workdir=Path(self.source_dir / self.workdir),
118
124
  env=environment,
119
125
  )
120
126
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.56
3
+ Version: 0.1.58
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,12 +1,12 @@
1
- primitive/__about__.py,sha256=G8f_XIhSuZl81EImSEsDRejrLptiz_CliMVlAJcUxdY,130
1
+ primitive/__about__.py,sha256=S0YUSrE8kYLnnrDEf3Zg8iyjiV8CQb2jsfZ4uoquTtc,130
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=VQPSewC6ouGdEG9W1gllawGJTydpOY0Lzg7LURXcqQg,2374
4
4
  primitive/client.py,sha256=vSJkifx450czuLvu0f2o-viSCC0p2f1UicA-2P5cJAw,2188
5
- primitive/agent/actions.py,sha256=m1FGvtOHdrZRP-YC31bFoUj-ZunXlFFW4NnPH9Bpzc0,5499
5
+ primitive/agent/actions.py,sha256=BnGHzh63R4ST_EqEB_hYEOzVwbzEaGKOZTaZo0vb6Vg,5818
6
6
  primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
7
7
  primitive/agent/process.py,sha256=2ZY3YoJHvoukrsCAZIt-AF2YKY4HEO5_jWji5K3W9fM,2267
8
8
  primitive/agent/provision.py,sha256=3EEzOV-ria6zf-pvfNddad1lzzd1QmfKInTIjmwX71Y,1673
9
- primitive/agent/runner.py,sha256=hDh6ip_Jb0EsvygrB7-GWVTOf-jN8E7H0RgCGOdQnPU,6634
9
+ primitive/agent/runner.py,sha256=wkvXjXxD7dg0XeZIvatpI12RSifYzRYUIL9NX42oRus,6876
10
10
  primitive/agent/uploader.py,sha256=5ZxonvRlMGRVBYx3hPEaWiPio5lMPi_zhtxz64V5S-A,2379
11
11
  primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  primitive/auth/actions.py,sha256=2vZEC3LLAXj6eBBmt_2OEDEcBIb3uLkkNjgbZTIaQsY,1095
@@ -46,8 +46,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
46
46
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
47
47
  primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
48
48
  primitive/utils/verible.py,sha256=r7c_hfqvL0UicMmIzK3Cy_BfZI1ZpcfBeLqKEWFWqJo,2252
49
- primitive-0.1.56.dist-info/METADATA,sha256=2IyWZdGzA3ZYaQUHQby350EkrKE339efkLSJa-bo_VA,3782
50
- primitive-0.1.56.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
51
- primitive-0.1.56.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
52
- primitive-0.1.56.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
53
- primitive-0.1.56.dist-info/RECORD,,
49
+ primitive-0.1.58.dist-info/METADATA,sha256=3QDuLyoZeKRlghEHBplLVLthic-a3o64edGzI3XHmzE,3782
50
+ primitive-0.1.58.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
51
+ primitive-0.1.58.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
52
+ primitive-0.1.58.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
53
+ primitive-0.1.58.dist-info/RECORD,,