primitive 0.2.7__tar.gz → 0.2.9__tar.gz
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-0.2.7 → primitive-0.2.9}/PKG-INFO +1 -1
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/__about__.py +1 -1
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/agent/runner.py +45 -8
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/graphql/sdk.py +3 -1
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/actions.py +3 -0
- {primitive-0.2.7 → primitive-0.2.9}/uv.lock +1 -2
- {primitive-0.2.7 → primitive-0.2.9}/.git-hooks/pre-commit +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/.gitattributes +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/.github/workflows/lint.yml +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/.github/workflows/publish.yml +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/.gitignore +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/.vscode/settings.json +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/LICENSE.txt +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/Makefile +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/README.md +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/linux setup.md +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/pyproject.toml +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/agent/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/agent/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/agent/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/agent/uploader.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/auth/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/auth/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/auth/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/auth/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/auth/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/cli.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/client.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/daemons/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/daemons/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/daemons/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/daemons/launch_agents.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/daemons/launch_service.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/exec/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/exec/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/exec/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/exec/interactive.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/files/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/git/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/git/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/git/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/git/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/git/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/graphql/relay.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/graphql/utility_fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/android.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/hardware/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/jobs/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/organizations/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/projects/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/provisioning/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/provisioning/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/provisioning/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/provisioning/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/commands.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/graphql/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/graphql/fragments.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/graphql/mutations.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/reservations/graphql/queries.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/__init__.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/actions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/auth.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/cache.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/chunk_size.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/config.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/exceptions.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/memory_size.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/printer.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/shell.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/src/primitive/utils/text.py +0 -0
- {primitive-0.2.7 → primitive-0.2.9}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.9
|
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,16 +1,18 @@
|
|
1
|
+
import asyncio
|
1
2
|
import os
|
2
3
|
import re
|
3
|
-
import typing
|
4
4
|
import shutil
|
5
5
|
import time
|
6
|
-
|
6
|
+
import typing
|
7
7
|
from abc import abstractmethod
|
8
|
-
from enum import
|
8
|
+
from enum import Enum, IntEnum
|
9
9
|
from pathlib import Path, PurePath
|
10
|
-
from
|
10
|
+
from typing import Dict, List, TypedDict
|
11
|
+
|
11
12
|
import yaml
|
12
|
-
import
|
13
|
-
|
13
|
+
from loguru import logger
|
14
|
+
|
15
|
+
from ..utils.cache import get_artifacts_cache, get_logs_cache, get_sources_cache
|
14
16
|
from ..utils.shell import env_to_dict
|
15
17
|
|
16
18
|
try:
|
@@ -168,10 +170,45 @@ class Runner:
|
|
168
170
|
else:
|
169
171
|
logger.success(f"Completed {self.job['slug']} job")
|
170
172
|
|
173
|
+
number_of_files_produced = self.get_number_of_files_produced()
|
174
|
+
logger.info(
|
175
|
+
f"Produced {number_of_files_produced} files for {self.job['slug']} job"
|
176
|
+
)
|
171
177
|
self.primitive.jobs.job_run_update(
|
172
|
-
self.job_run["id"],
|
178
|
+
self.job_run["id"],
|
179
|
+
status="request_completed",
|
180
|
+
conclusion=conclusion,
|
181
|
+
number_of_files_produced=number_of_files_produced,
|
173
182
|
)
|
174
183
|
|
184
|
+
def get_number_of_files_produced(self) -> int:
|
185
|
+
"""Returns the number of files produced by the job."""
|
186
|
+
number_of_files_produced = 0
|
187
|
+
|
188
|
+
# Logs can be produced even if no artifact stores are created for the job run.
|
189
|
+
job_run_logs_cache = get_logs_cache(self.job_run["id"])
|
190
|
+
log_files = [
|
191
|
+
file
|
192
|
+
for _, _, current_path_files in job_run_logs_cache.walk()
|
193
|
+
for file in current_path_files
|
194
|
+
]
|
195
|
+
|
196
|
+
number_of_files_produced += len(log_files)
|
197
|
+
|
198
|
+
if "stores" not in self.config:
|
199
|
+
return number_of_files_produced
|
200
|
+
|
201
|
+
job_run_artifacts_cache = get_artifacts_cache(self.job_run["id"])
|
202
|
+
artifact_files = [
|
203
|
+
file
|
204
|
+
for _, _, current_path_files in job_run_artifacts_cache.walk()
|
205
|
+
for file in current_path_files
|
206
|
+
]
|
207
|
+
|
208
|
+
number_of_files_produced += len(artifact_files)
|
209
|
+
|
210
|
+
return number_of_files_produced
|
211
|
+
|
175
212
|
async def run_task(self, task: Task) -> bool:
|
176
213
|
for cmd in task["cmd"].strip().split("\n"):
|
177
214
|
# Adding an additional echo and utilizing stdbuf to force line buffering
|
@@ -317,7 +354,7 @@ class Runner:
|
|
317
354
|
|
318
355
|
return True
|
319
356
|
|
320
|
-
time.sleep(
|
357
|
+
time.sleep(10)
|
321
358
|
|
322
359
|
return False
|
323
360
|
|
@@ -28,7 +28,9 @@ def create_session(
|
|
28
28
|
|
29
29
|
transport = AIOHTTPTransport(url=url, headers=headers)
|
30
30
|
session = Client(
|
31
|
-
transport=transport,
|
31
|
+
transport=transport,
|
32
|
+
fetch_schema_from_transport=fetch_schema_from_transport,
|
33
|
+
execute_timeout=None, # Prevents timeout errors on async transports
|
32
34
|
)
|
33
35
|
return session
|
34
36
|
|
@@ -113,6 +113,7 @@ class Jobs(BaseAction):
|
|
113
113
|
status: str = None,
|
114
114
|
conclusion: str = None,
|
115
115
|
file_ids: Optional[List[str]] = [],
|
116
|
+
number_of_files_produced: Optional[int] = None,
|
116
117
|
):
|
117
118
|
mutation = gql(job_run_update_mutation)
|
118
119
|
input = {"id": id}
|
@@ -122,6 +123,8 @@ class Jobs(BaseAction):
|
|
122
123
|
input["conclusion"] = conclusion
|
123
124
|
if file_ids and len(file_ids) > 0:
|
124
125
|
input["files"] = file_ids
|
126
|
+
if number_of_files_produced is not None:
|
127
|
+
input["numberOfFilesProduced"] = number_of_files_produced
|
125
128
|
variables = {"input": input}
|
126
129
|
result = self.primitive.session.execute(
|
127
130
|
mutation, variable_values=variables, get_execution_result=True
|
@@ -283,7 +283,7 @@ name = "click"
|
|
283
283
|
version = "8.1.8"
|
284
284
|
source = { registry = "https://pypi.org/simple" }
|
285
285
|
dependencies = [
|
286
|
-
{ name = "colorama", marker = "
|
286
|
+
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
287
287
|
]
|
288
288
|
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 }
|
289
289
|
wheels = [
|
@@ -710,7 +710,6 @@ wheels = [
|
|
710
710
|
|
711
711
|
[[package]]
|
712
712
|
name = "primitive"
|
713
|
-
version = "0.1.89"
|
714
713
|
source = { editable = "." }
|
715
714
|
dependencies = [
|
716
715
|
{ name = "click" },
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|