primitive 0.2.48__py3-none-any.whl → 0.2.50__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: 2025-present Dylan Stein <dylan@primitive.tech>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.2.48"
4
+ __version__ = "0.2.50"
primitive/agent/runner.py CHANGED
@@ -6,18 +6,12 @@ from enum import Enum, IntEnum
6
6
  from pathlib import Path, PurePath
7
7
  from typing import Dict, List, TypedDict
8
8
 
9
- import yaml
10
9
  from loguru import logger
11
10
 
12
11
  from primitive.utils.cache import get_artifacts_cache, get_logs_cache, get_sources_cache
13
12
  from primitive.utils.logging import fmt, log_context
14
13
  from primitive.utils.psutil import kill_process_and_children
15
14
 
16
- try:
17
- from yaml import CLoader as Loader
18
- except ImportError:
19
- from yaml import Loader
20
-
21
15
  if typing.TYPE_CHECKING:
22
16
  import primitive.client
23
17
 
@@ -60,7 +54,7 @@ class Runner:
60
54
  self.job = job_run["job"]
61
55
  self.job_run = job_run
62
56
  self.job_settings = job_run["jobSettings"]
63
- self.config = None
57
+ self.config = job_run["jobSettings"]["config"]
64
58
  self.initial_env = {}
65
59
  self.modified_env = {}
66
60
  self.file_logger = None
@@ -100,22 +94,6 @@ class Runner:
100
94
  self.job_settings["rootDirectory"]
101
95
  )
102
96
 
103
- job_filename = self.job_settings["repositoryFilename"]
104
- logger.info(f"Scanning directory for job file {job_filename}")
105
-
106
- job_config_file = Path(self.source_dir / ".primitive" / job_filename)
107
-
108
- if job_config_file.exists():
109
- logger.info(
110
- f"Found job description for {self.job['slug']} at {job_config_file}"
111
- )
112
- self.config = yaml.load(open(job_config_file, "r"), Loader=Loader)
113
- else:
114
- logger.error(
115
- f"No job description with matching filename '{job_filename}' found"
116
- )
117
- raise FileNotFoundError
118
-
119
97
  # Setup initial process environment
120
98
  self.initial_env = os.environ
121
99
  self.initial_env = {
@@ -60,6 +60,8 @@ class Monitor(BaseAction):
60
60
  previous_reservation_id = None
61
61
  active_reservation_id = None
62
62
 
63
+ last_provisioned_reservation_id = None
64
+
63
65
  while True:
64
66
  # this block determines if there is a reservation at all
65
67
  # handles cleanup of old reservations
@@ -108,12 +110,11 @@ class Monitor(BaseAction):
108
110
  )
109
111
  job_run_id = job_run_data.get("id")
110
112
  previous_reservation_id = None
113
+ last_provisioned_reservation_id = None
111
114
 
112
115
  # if we are on the new reservation
113
- elif (
114
- (previous_reservation_id is not None)
115
- and (active_reservation_id is not None)
116
- and (previous_reservation_id == active_reservation_id)
116
+ elif (active_reservation_id is not None) and (
117
+ last_provisioned_reservation_id != active_reservation_id
117
118
  ):
118
119
  logger.info(
119
120
  f"Reason: {active_reservation_data.get('reason', '')}"
@@ -121,6 +122,7 @@ class Monitor(BaseAction):
121
122
  self.primitive.provisioning.add_reservation_authorized_keys(
122
123
  reservation_id=active_reservation_id
123
124
  )
125
+ last_provisioned_reservation_id = active_reservation_id
124
126
 
125
127
  # we have an active reservation, check if we have JobRuns attached to it
126
128
  if active_reservation_id is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primitive
3
- Version: 0.2.48
3
+ Version: 0.2.50
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
@@ -23,7 +23,6 @@ Requires-Dist: gql[all]
23
23
  Requires-Dist: loguru
24
24
  Requires-Dist: paramiko[invoke]
25
25
  Requires-Dist: psutil>=7.0.0
26
- Requires-Dist: pyyaml
27
26
  Requires-Dist: rich>=13.9.4
28
27
  Requires-Dist: speedtest-cli
29
28
  Description-Content-Type: text/markdown
@@ -1,11 +1,11 @@
1
- primitive/__about__.py,sha256=bd7zqrhM-zA3yQP6j5b6PPQSsJvyGOYbK2kklQX6w44,130
1
+ primitive/__about__.py,sha256=pVgRtP9euIj2aqbCG6NFCty_F3aeISv6t3lLrnVIYEo,130
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=g7EtHI9MATAB0qQu5w-WzbXtxz_8zu8z5E7sETmMkKU,2509
4
4
  primitive/client.py,sha256=RMF46F89oK82gfZH6Bf0WZrhXPUu01pbieSO_Vcuoc4,3624
5
5
  primitive/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  primitive/agent/actions.py,sha256=Ald56Lq8KOtQ0_eFm2TseKkEIa8RP3IClLNVyv9IL4E,7035
7
7
  primitive/agent/commands.py,sha256=o847pK7v7EWQGG67tky6a33qtwoutX6LZrP2FIS_NOk,388
8
- primitive/agent/runner.py,sha256=MBMRv0gKkj9n2JKPie1hiHZvHUfTxEqM53-7o7yx8TY,12021
8
+ primitive/agent/runner.py,sha256=deMLa4l758k-BeK7Up4LVeD9hXfmAf6o3jJh8OmURys,11315
9
9
  primitive/agent/uploader.py,sha256=ZzrzsajNBogwEC7mT6Ejy0h2Jd9axMYGzt9pbCvVMlk,3171
10
10
  primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  primitive/auth/actions.py,sha256=9NIEXJ1BNJutJs6AMMSjMN_ziONUAUhY_xHwojYJCLA,942
@@ -54,7 +54,7 @@ primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
54
54
  primitive/jobs/graphql/fragments.py,sha256=Ldhsc-NFHZGY8_1FjO2uZIdOL5UUGZjsldHea_GLJ_g,667
55
55
  primitive/jobs/graphql/mutations.py,sha256=8ASvCmwQh7cMeeiykOdYaYVryG8FRIuVF6v_J8JJZuw,219
56
56
  primitive/jobs/graphql/queries.py,sha256=ZxNmm-WovytbggNuKRnwa0kc26T34_0yhqkoqx-2uj0,1736
57
- primitive/monitor/actions.py,sha256=80adDYkXi8i1C6WCV1N75tFAMhEbRw2NBMobWoFwpbg,9447
57
+ primitive/monitor/actions.py,sha256=nXa8UZT0dXVZma39KDnIpxHt3147xWpnflLIHGOQHpg,9558
58
58
  primitive/monitor/commands.py,sha256=VDlEL_Qpm_ysHxug7VpI0cVAZ0ny6AS91Y58D7F1zkU,409
59
59
  primitive/organizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  primitive/organizations/actions.py,sha256=kVHOhG1oS2sI5p8uldSo5L-RUZsnG36eaulVuKLyZ-M,1863
@@ -95,8 +95,8 @@ primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,37
95
95
  primitive/utils/psutil.py,sha256=xa7ef435UL37jyjmUPbEqCO2ayQMpCs0HCrxVEvLcuM,763
96
96
  primitive/utils/shell.py,sha256=Z4zxmOaSyGCrS0D6I436iQci-ewHLt4UxVg1CD9Serc,2171
97
97
  primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
98
- primitive-0.2.48.dist-info/METADATA,sha256=P4J6B0qzIe8UFyYrv7Kw24wNFpJv3cxRgieyWuUR_lA,3535
99
- primitive-0.2.48.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
- primitive-0.2.48.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
101
- primitive-0.2.48.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
102
- primitive-0.2.48.dist-info/RECORD,,
98
+ primitive-0.2.50.dist-info/METADATA,sha256=KcFa1iuH5VN3jpBUJD6-85Cnyka0p-cb8wLWmEr_JnQ,3513
99
+ primitive-0.2.50.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
100
+ primitive-0.2.50.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
101
+ primitive-0.2.50.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
102
+ primitive-0.2.50.dist-info/RECORD,,