primitive 0.2.29__py3-none-any.whl → 0.2.31__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 +2 -2
- primitive/agent/runner.py +6 -14
- primitive/daemons/launch_agents.py +1 -1
- primitive/db/sqlite.py +18 -5
- primitive/jobs/graphql/fragments.py +1 -0
- primitive/monitor/actions.py +3 -2
- {primitive-0.2.29.dist-info → primitive-0.2.31.dist-info}/METADATA +1 -1
- {primitive-0.2.29.dist-info → primitive-0.2.31.dist-info}/RECORD +12 -12
- {primitive-0.2.29.dist-info → primitive-0.2.31.dist-info}/WHEEL +0 -0
- {primitive-0.2.29.dist-info → primitive-0.2.31.dist-info}/entry_points.txt +0 -0
- {primitive-0.2.29.dist-info → primitive-0.2.31.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/actions.py
CHANGED
@@ -6,8 +6,8 @@ from loguru import logger
|
|
6
6
|
from primitive.__about__ import __version__
|
7
7
|
from primitive.agent.runner import Runner
|
8
8
|
from primitive.agent.uploader import Uploader
|
9
|
-
from primitive.db import sqlite
|
10
9
|
from primitive.db.models import JobRun
|
10
|
+
from primitive.db.sqlite import wait_for_db
|
11
11
|
from primitive.utils.actions import BaseAction
|
12
12
|
|
13
13
|
|
@@ -27,7 +27,7 @@ class Agent(BaseAction):
|
|
27
27
|
logger.info(f"Version: {__version__}")
|
28
28
|
|
29
29
|
# Wait for monitor to make database
|
30
|
-
|
30
|
+
wait_for_db()
|
31
31
|
|
32
32
|
# Create uploader
|
33
33
|
uploader = Uploader(primitive=self.primitive)
|
primitive/agent/runner.py
CHANGED
@@ -116,25 +116,17 @@ class Runner:
|
|
116
116
|
)
|
117
117
|
|
118
118
|
# Attempt to parse the job yaml file
|
119
|
-
|
120
|
-
|
121
|
-
yml_file = Path(self.source_dir / ".primitive" / f"{self.job['slug']}.yml")
|
119
|
+
job_filename = self.job_settings["repositoryFilename"]
|
120
|
+
logger.info(f"Scanning directory for job file {job_filename}")
|
122
121
|
|
123
|
-
|
124
|
-
logger.error(
|
125
|
-
f"Found two job descriptions with the same slug: {self.job['slug']}"
|
126
|
-
)
|
127
|
-
raise FileExistsError
|
122
|
+
job_config_file = Path(self.source_dir / ".primitive" / job_filename)
|
128
123
|
|
129
|
-
if
|
124
|
+
if job_config_file.exists():
|
130
125
|
logger.info(f"Found job description for {self.job['slug']}")
|
131
|
-
|
132
|
-
self.config = yaml.load(open(config_file, "r"), Loader=Loader)[
|
133
|
-
self.job["name"]
|
134
|
-
]
|
126
|
+
self.config = yaml.load(open(job_config_file, "r"), Loader=Loader)
|
135
127
|
else:
|
136
128
|
logger.error(
|
137
|
-
f"No job description with matching
|
129
|
+
f"No job description with matching filename '{job_filename}' found"
|
138
130
|
)
|
139
131
|
raise FileNotFoundError
|
140
132
|
|
@@ -132,7 +132,7 @@ class LaunchAgent(Daemon):
|
|
132
132
|
<key>ProgramArguments</key>
|
133
133
|
<array>
|
134
134
|
<string>{self.executable}</string>
|
135
|
-
<string>{self.command}
|
135
|
+
{"".join([f"<string>{arg}</string>" for arg in self.command.split(" ") if arg.strip() != ""])}
|
136
136
|
</array>
|
137
137
|
<key>RunAtLoad</key>
|
138
138
|
<true/>
|
primitive/db/sqlite.py
CHANGED
@@ -2,7 +2,7 @@ from pathlib import Path
|
|
2
2
|
from time import sleep
|
3
3
|
|
4
4
|
from loguru import logger
|
5
|
-
from sqlalchemy import Engine, create_engine
|
5
|
+
from sqlalchemy import Engine, create_engine, inspect
|
6
6
|
from sqlalchemy.orm import Session as SQLAlchemySession
|
7
7
|
|
8
8
|
from primitive.db.base import Base
|
@@ -39,15 +39,28 @@ def wait_for_db() -> None:
|
|
39
39
|
logger.debug(
|
40
40
|
f"Waiting for SQLite database to be created... [{current_try} / {max_tries}]"
|
41
41
|
)
|
42
|
-
db_path.touch()
|
43
42
|
sleep(1)
|
44
43
|
current_try += 1
|
45
44
|
continue
|
46
45
|
if current_try > max_tries:
|
47
|
-
|
48
|
-
|
46
|
+
message = f"SQLite database was not created after {max_tries} tries. Exiting..."
|
47
|
+
logger.error(message)
|
48
|
+
raise RuntimeError(message)
|
49
|
+
|
50
|
+
# check if table exists
|
51
|
+
max_tries = 60
|
52
|
+
current_try = 1
|
53
|
+
while not inspect(engine()).has_table("JobRun") and current_try <= max_tries:
|
54
|
+
logger.error("SQLite database is not ready.")
|
55
|
+
sleep(1)
|
56
|
+
current_try += 1
|
57
|
+
continue
|
58
|
+
if current_try > max_tries:
|
59
|
+
message = (
|
60
|
+
f"Database tables were not created after {max_tries} tries. Exiting..."
|
49
61
|
)
|
50
|
-
|
62
|
+
logger.error(message)
|
63
|
+
raise RuntimeError(message)
|
51
64
|
logger.debug("SQLite database is ready.")
|
52
65
|
|
53
66
|
|
primitive/monitor/actions.py
CHANGED
@@ -6,8 +6,8 @@ import psutil
|
|
6
6
|
from loguru import logger
|
7
7
|
|
8
8
|
from primitive.__about__ import __version__
|
9
|
-
from primitive.db import sqlite
|
10
9
|
from primitive.db.models import JobRun
|
10
|
+
from primitive.db.sqlite import init, wait_for_db
|
11
11
|
from primitive.utils.actions import BaseAction
|
12
12
|
from primitive.utils.exceptions import P_CLI_100
|
13
13
|
|
@@ -45,7 +45,8 @@ class Monitor(BaseAction):
|
|
45
45
|
sys.exit(1)
|
46
46
|
|
47
47
|
# Initialize the database
|
48
|
-
|
48
|
+
init()
|
49
|
+
wait_for_db()
|
49
50
|
|
50
51
|
try:
|
51
52
|
if job_run_id is not None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.31
|
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,11 +1,11 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=LH2fP6k1EgAIeykRYn1baGNEf_y6ro_QPuG8jugYJpo,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=h8WZVnQylVe0vbpuyC8YZHl2JyITSPC-1HbUcmrE5pc,3623
|
5
5
|
primitive/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
primitive/agent/actions.py,sha256=
|
6
|
+
primitive/agent/actions.py,sha256=HDktV5FwtD19Bieg653w-ZWp7dQHTOj7cQx0-Aiae84,3836
|
7
7
|
primitive/agent/commands.py,sha256=cK7d3OcN5Z65gQWVZFQ-Y9ddw9Pes4f9OVBpeMsj5sE,255
|
8
|
-
primitive/agent/runner.py,sha256=
|
8
|
+
primitive/agent/runner.py,sha256=SGI_vcFfey-VUH3gQasVJRgzPeSLMlP6FBjSImJqbOA,14180
|
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
|
@@ -15,12 +15,12 @@ primitive/auth/graphql/queries.py,sha256=jhrr_VFzHIn8vcVprMIzUx7V4kkWYdR6CKMKPoV
|
|
15
15
|
primitive/daemons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
primitive/daemons/actions.py,sha256=dqhxgIDxiJlcN6xvkzgBerN215KvbBKKdWteRpT_ICs,2730
|
17
17
|
primitive/daemons/commands.py,sha256=Xt4qFymNrDLdHJhRnEH_4Re-2xX6w1OT-chV9k7dFCs,2670
|
18
|
-
primitive/daemons/launch_agents.py,sha256=
|
18
|
+
primitive/daemons/launch_agents.py,sha256=cCxsvCBFmGlKOiBINsKi_NxcozLC8yPw3w6pxqnz-qI,7803
|
19
19
|
primitive/daemons/launch_service.py,sha256=iuklHeuEqadlf8U1n9xFg4ZG1EKdK2jyaPI-VTlpJ4I,7907
|
20
20
|
primitive/daemons/ui.py,sha256=Af3OJWJ0jdGlb1nfA5yaGYdhBEqqpM8zP2U2vUQdCbw,1236
|
21
21
|
primitive/db/base.py,sha256=mH7f2d_jiyxJSSx9Gk53QBXRa3LiKBsBjkFgvmtH1WA,83
|
22
22
|
primitive/db/models.py,sha256=GfnJdAq4Tb68CI4BKAuJDZVqioGavveaAHbCPeLNngw,2840
|
23
|
-
primitive/db/sqlite.py,sha256=
|
23
|
+
primitive/db/sqlite.py,sha256=ZtSi8Z0wiA5NEvgnP7udSwZnoUMLp0qMWfNZNC3htuI,2116
|
24
24
|
primitive/exec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
primitive/exec/actions.py,sha256=4d_TCjNDcVFoZ9Zw7ZuBa6hKMv2Xzm7_UX_8wcX1aSk,4124
|
26
26
|
primitive/exec/commands.py,sha256=66LO2kkJC-ynNZQpUCXv4Ol15QoacdSZAHblePDcmLo,510
|
@@ -54,10 +54,10 @@ primitive/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
primitive/jobs/actions.py,sha256=lOfmjzZ7XvqLyP0f-ilyfYwQQZuNgUb4qxFCpf1d93M,5076
|
55
55
|
primitive/jobs/commands.py,sha256=MxPCkBEYW_eLNqgCRYeyj7ZcLOFAWfpVZlqDR2Y_S0o,830
|
56
56
|
primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
|
-
primitive/jobs/graphql/fragments.py,sha256=
|
57
|
+
primitive/jobs/graphql/fragments.py,sha256=pS6jXZ9yxvPKjKx50zpwzARJHYlg7NQLYCm1voiuCzI,642
|
58
58
|
primitive/jobs/graphql/mutations.py,sha256=8ASvCmwQh7cMeeiykOdYaYVryG8FRIuVF6v_J8JJZuw,219
|
59
59
|
primitive/jobs/graphql/queries.py,sha256=BrU_GnLjK0bTAmWsLSmGEUea7EM8MqTKxN1Qp6sSjwc,1597
|
60
|
-
primitive/monitor/actions.py,sha256=
|
60
|
+
primitive/monitor/actions.py,sha256=aYe5OfgCxhapXbcvz7vSlIMAcLOFRcAUWmdBZ8H7UWs,10889
|
61
61
|
primitive/monitor/commands.py,sha256=VDlEL_Qpm_ysHxug7VpI0cVAZ0ny6AS91Y58D7F1zkU,409
|
62
62
|
primitive/organizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
63
|
primitive/organizations/actions.py,sha256=kVHOhG1oS2sI5p8uldSo5L-RUZsnG36eaulVuKLyZ-M,1863
|
@@ -96,8 +96,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
|
|
96
96
|
primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
|
97
97
|
primitive/utils/shell.py,sha256=jWzb7ky7p987dJas6ZvarK3IJNZ5cwBXcryRWb9Uh6U,2072
|
98
98
|
primitive/utils/text.py,sha256=XiESMnlhjQ534xE2hMNf08WehE1SKaYFRNih0MmnK0k,829
|
99
|
-
primitive-0.2.
|
100
|
-
primitive-0.2.
|
101
|
-
primitive-0.2.
|
102
|
-
primitive-0.2.
|
103
|
-
primitive-0.2.
|
99
|
+
primitive-0.2.31.dist-info/METADATA,sha256=jEXyjNe3Uv2BFG9MZAUt0Em4YMU950c4T_xUq26f7NY,3569
|
100
|
+
primitive-0.2.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
101
|
+
primitive-0.2.31.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
102
|
+
primitive-0.2.31.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
103
|
+
primitive-0.2.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|