primitive 0.1.74__py3-none-any.whl → 0.1.76__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/runner.py +9 -12
- primitive/agent/uploader.py +1 -1
- primitive/auth/commands.py +4 -3
- primitive/graphql/sdk.py +3 -1
- primitive/utils/auth.py +23 -0
- primitive/utils/files.py +1 -1
- {primitive-0.1.74.dist-info → primitive-0.1.76.dist-info}/METADATA +4 -3
- {primitive-0.1.74.dist-info → primitive-0.1.76.dist-info}/RECORD +12 -12
- {primitive-0.1.74.dist-info → primitive-0.1.76.dist-info}/WHEEL +1 -1
- {primitive-0.1.74.dist-info → primitive-0.1.76.dist-info}/entry_points.txt +0 -0
- {primitive-0.1.74.dist-info → primitive-0.1.76.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/runner.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import threading
|
3
3
|
import typing
|
4
|
-
import json
|
5
4
|
from pathlib import Path, PurePath
|
6
5
|
from time import sleep
|
7
6
|
from typing import Dict, Iterable, List, Optional, TypedDict, Callable
|
@@ -109,18 +108,16 @@ class AgentRunner:
|
|
109
108
|
if "step" in record["extra"]:
|
110
109
|
step = record["extra"]["step"]
|
111
110
|
|
112
|
-
log =
|
113
|
-
"time
|
114
|
-
"
|
115
|
-
"level
|
116
|
-
"
|
117
|
-
"name
|
118
|
-
"
|
119
|
-
|
120
|
-
|
121
|
-
record["extra"]["serialized"] = json.dumps(log)
|
111
|
+
log = (
|
112
|
+
"<green>{time:YYYY-MM-DD HH:mm:ss.SSS!UTC}</green> | "
|
113
|
+
"<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | "
|
114
|
+
"<level>{level}</level> | "
|
115
|
+
f"{step} | "
|
116
|
+
"<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - "
|
117
|
+
"<level>{message}</level>\n"
|
118
|
+
)
|
122
119
|
|
123
|
-
return
|
120
|
+
return log
|
124
121
|
|
125
122
|
return fmt
|
126
123
|
|
primitive/agent/uploader.py
CHANGED
@@ -47,7 +47,7 @@ class Uploader:
|
|
47
47
|
for file in files:
|
48
48
|
result = self.primitive.files.upload_file_direct(
|
49
49
|
path=file,
|
50
|
-
key_prefix=str(PurePath(file).relative_to(cache.parent).parent)
|
50
|
+
key_prefix=str(PurePath(file).relative_to(cache.parent).parent),
|
51
51
|
)
|
52
52
|
upload_id = result.data["fileUpdate"]["id"]
|
53
53
|
|
primitive/auth/commands.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
import os
|
2
|
+
import typing
|
2
3
|
import webbrowser
|
4
|
+
|
3
5
|
import click
|
4
|
-
|
6
|
+
|
5
7
|
from ..utils.config import PRIMITIVE_CREDENTIALS_FILEPATH
|
6
8
|
from ..utils.printer import print_result
|
7
|
-
|
8
|
-
import typing
|
9
|
+
from .actions import Auth
|
9
10
|
|
10
11
|
if typing.TYPE_CHECKING:
|
11
12
|
from ..client import Primitive
|
primitive/graphql/sdk.py
CHANGED
primitive/utils/auth.py
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
+
import backoff
|
4
|
+
from aiohttp.client_exceptions import ClientConnectorError
|
5
|
+
from gql.transport.exceptions import TransportServerError
|
3
6
|
from loguru import logger
|
4
7
|
|
5
8
|
from ..graphql.sdk import create_session
|
6
9
|
|
10
|
+
MAX_TIME_FOR_BACKOFF = 60 * 15 # 15 minutes
|
11
|
+
|
12
|
+
|
13
|
+
def connection_backoff_handler(details):
|
14
|
+
logger.enable("primitive")
|
15
|
+
logger.error(
|
16
|
+
"Cannot connect to API. Waiting {wait:0.1f} seconds after {tries} tries.".format(
|
17
|
+
**details
|
18
|
+
)
|
19
|
+
)
|
20
|
+
|
7
21
|
|
8
22
|
def create_new_session(primitive):
|
9
23
|
token = primitive.host_config.get("token")
|
@@ -26,6 +40,15 @@ def create_new_session(primitive):
|
|
26
40
|
|
27
41
|
|
28
42
|
def guard(func):
|
43
|
+
@backoff.on_exception(
|
44
|
+
backoff.expo,
|
45
|
+
(
|
46
|
+
ClientConnectorError,
|
47
|
+
TransportServerError,
|
48
|
+
),
|
49
|
+
on_backoff=connection_backoff_handler,
|
50
|
+
max_time=MAX_TIME_FOR_BACKOFF,
|
51
|
+
)
|
29
52
|
def wrapper(self, *args, **kwargs):
|
30
53
|
if self.primitive.session is None:
|
31
54
|
self.primitive.session = create_new_session(self.primitive)
|
primitive/utils/files.py
CHANGED
@@ -19,7 +19,7 @@ def find_files_for_extension(source: Path, extensions: Tuple[str]) -> List[Path]
|
|
19
19
|
for filename in filenames:
|
20
20
|
if filename.endswith(extensions):
|
21
21
|
matching_files.append(Path(dirpath).joinpath(filename))
|
22
|
-
|
22
|
+
|
23
23
|
logger.debug(
|
24
24
|
f"Found {len(matching_files)} following files that match: {matching_files}"
|
25
25
|
)
|
@@ -1,11 +1,12 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.76
|
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
|
7
7
|
Author-email: Dylan Stein <dylan@primitive.tech>, Chase Zimmerman <chase@primitive.tech>
|
8
|
-
License: MIT
|
8
|
+
License-Expression: MIT
|
9
|
+
License-File: LICENSE.txt
|
9
10
|
Classifier: Development Status :: 4 - Beta
|
10
11
|
Classifier: Programming Language :: Python
|
11
12
|
Classifier: Programming Language :: Python :: 3
|
@@ -1,4 +1,4 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=EYbYfJTot30aqVJWBENADheY8VcBhNRZTzkewjATzNc,130
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=CiI60bG3UZyNFuLTpchr0KeJRG5SALj455Ob11CegGE,2412
|
4
4
|
primitive/client.py,sha256=PPyIQRvKKSqCF9RRF5mJJ4Vqqolpzy1YXqffNLKIvAA,2390
|
@@ -7,11 +7,11 @@ primitive/agent/actions.py,sha256=Hosy2o2FntfBtcNqqHuMFq9dm99EVfySy0v2JGeufvc,64
|
|
7
7
|
primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
|
8
8
|
primitive/agent/process.py,sha256=7o8axjJ1OauKaFBL0jbZL9tGlZdZbDCXAdT5F-S_XQ8,2541
|
9
9
|
primitive/agent/provision.py,sha256=rmwnro1K5F8mwtd45XAq7RVQmpDWnbBCQ8X_qgWhm3M,1546
|
10
|
-
primitive/agent/runner.py,sha256=
|
11
|
-
primitive/agent/uploader.py,sha256=
|
10
|
+
primitive/agent/runner.py,sha256=b2Rdm44-w_1_uMwODjrfMvb75n8vVmCTDsvaiiU7-d8,8442
|
11
|
+
primitive/agent/uploader.py,sha256=OkgwXhWKoECOJnW_ZmpzmUS_cpb-orC_uebNcmf5byw,2948
|
12
12
|
primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
primitive/auth/actions.py,sha256=MPsG9LcKcOPwA7gZ9Ewk0PZJhTQvIrGfODdz4GxSzgA,999
|
14
|
-
primitive/auth/commands.py,sha256=
|
14
|
+
primitive/auth/commands.py,sha256=2z5u5xX64n0yILucx9emtWh3uQXLvs2QQQQIldZGr94,2341
|
15
15
|
primitive/auth/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
primitive/auth/graphql/queries.py,sha256=jhrr_VFzHIn8vcVprMIzUx7V4kkWYdR6CKMKPoVFv60,180
|
17
17
|
primitive/daemons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -37,7 +37,7 @@ primitive/git/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
37
37
|
primitive/git/graphql/queries.py,sha256=I1HGlqBb1lHIAWVSsC8tVY9JdsQ8DJVqs4nqSTcL30M,98
|
38
38
|
primitive/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
39
|
primitive/graphql/relay.py,sha256=bmij2AjdpURQ6GGVCxwWhauF-r_SxuAU2oJ4sDbLxpI,726
|
40
|
-
primitive/graphql/sdk.py,sha256=
|
40
|
+
primitive/graphql/sdk.py,sha256=DBFH8vw8FAGvRy8_FZc9WcjnwaQDlXmI8fiYmhCg-b0,1458
|
41
41
|
primitive/graphql/utility_fragments.py,sha256=uIjwILC4QtWNyO5vu77VjQf_p0jvP3A9q_6zRq91zqs,303
|
42
42
|
primitive/hardware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
43
|
primitive/hardware/actions.py,sha256=jtthNgRyeRD8txt4WqEZskPtsDWU2Yg2gJZLSrEx1io,18603
|
@@ -80,18 +80,18 @@ primitive/reservations/graphql/mutations.py,sha256=IqzwQL7OclN7RpIcidrTQo9cGYofY
|
|
80
80
|
primitive/reservations/graphql/queries.py,sha256=x31wTRelskX2fc0fx2qrY7XT1q74nvzLv_Xef3o9weg,746
|
81
81
|
primitive/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
primitive/utils/actions.py,sha256=HOFrmM3-0A_A3NS84MqrZ6JmQEiiPSoDqEeuu6b_qfQ,196
|
83
|
-
primitive/utils/auth.py,sha256=
|
83
|
+
primitive/utils/auth.py,sha256=_BJ_25ACq-GVzLvF4eHFJ1Q_gk2A_HkDg52geNzxIAc,1495
|
84
84
|
primitive/utils/cache.py,sha256=FHGmVWYLJFQOazpXXcEwI0YJEZbdkgG39nOLdOv6VNk,1575
|
85
85
|
primitive/utils/chunk_size.py,sha256=PAuVuirUTA9oRXyjo1c6MWxo31WVBRkWMuWw-AS58Bw,2914
|
86
86
|
primitive/utils/config.py,sha256=DlFM5Nglo22WPtbpZSVtH7NX-PTMaKYlcrUE7GPRG4c,1058
|
87
|
-
primitive/utils/files.py,sha256=
|
87
|
+
primitive/utils/files.py,sha256=QUa7c4t2PNvKOtyndLAxQMGvDM4cBftSeFh28xprVbM,752
|
88
88
|
primitive/utils/git.py,sha256=1qNOu8X-33CavmrD580BmrFhD_WVO9PGWHUUboXJR_g,663
|
89
89
|
primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIUk,3058
|
90
90
|
primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
|
91
91
|
primitive/utils/shell.py,sha256=j7E1YwgNWw57dFHVfEbqRNVcPHX0xDefX2vFSNgeI_8,1648
|
92
92
|
primitive/utils/verible.py,sha256=Zb5NUISvcaIgEvgCDBWr-GCoceMa79Tcwvr5Wl9lfnA,2252
|
93
|
-
primitive-0.1.
|
94
|
-
primitive-0.1.
|
95
|
-
primitive-0.1.
|
96
|
-
primitive-0.1.
|
97
|
-
primitive-0.1.
|
93
|
+
primitive-0.1.76.dist-info/METADATA,sha256=zXs0TSPKi3K2exL-kdRFHNEWv1YVWd8MLg-xNLC4wxY,3843
|
94
|
+
primitive-0.1.76.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
95
|
+
primitive-0.1.76.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
96
|
+
primitive-0.1.76.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
97
|
+
primitive-0.1.76.dist-info/RECORD,,
|
File without changes
|
File without changes
|