primitive 0.2.29__py3-none-any.whl → 0.2.30__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/db/sqlite.py +18 -5
- primitive/monitor/actions.py +3 -2
- {primitive-0.2.29.dist-info → primitive-0.2.30.dist-info}/METADATA +1 -1
- {primitive-0.2.29.dist-info → primitive-0.2.30.dist-info}/RECORD +9 -9
- {primitive-0.2.29.dist-info → primitive-0.2.30.dist-info}/WHEEL +0 -0
- {primitive-0.2.29.dist-info → primitive-0.2.30.dist-info}/entry_points.txt +0 -0
- {primitive-0.2.29.dist-info → primitive-0.2.30.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/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.30
|
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,9 +1,9 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=RmCzeHEVe-XHumqPgZrfYW5qjcAtsXdA16gAEzHGmjQ,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
8
|
primitive/agent/runner.py,sha256=CoRyReO3jPV8B7vILVWdszFD4GVop7HsVEUo1hoRXjo,14556
|
9
9
|
primitive/agent/uploader.py,sha256=ZzrzsajNBogwEC7mT6Ejy0h2Jd9axMYGzt9pbCvVMlk,3171
|
@@ -20,7 +20,7 @@ primitive/daemons/launch_service.py,sha256=iuklHeuEqadlf8U1n9xFg4ZG1EKdK2jyaPI-V
|
|
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
|
@@ -57,7 +57,7 @@ primitive/jobs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
57
57
|
primitive/jobs/graphql/fragments.py,sha256=1_ZttT7dx36KDC3DClJz9M8LMpsPwXySBygHSiUEcGg,619
|
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.30.dist-info/METADATA,sha256=WAlddgCvqYTWwuqvUNQJIyGHtGZgNFB0cAWKP2PvWiY,3569
|
100
|
+
primitive-0.2.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
101
|
+
primitive-0.2.30.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
102
|
+
primitive-0.2.30.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
103
|
+
primitive-0.2.30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|