crunch-cli 12.0.2__tar.gz → 12.1.0__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.
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/PKG-INFO +2 -2
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/__version__.py +1 -1
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/__init__.py +1 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_errors.py +42 -29
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/push.py +8 -4
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/library.py +14 -7
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/cloud.py +14 -5
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/local.py +3 -2
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/unstructured.py +6 -1
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/PKG-INFO +2 -2
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/requires.txt +1 -1
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/README.md +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/__main__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_auth.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_client.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/common.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/competition.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/crunch.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/data_release.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/enum_.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/leaderboard.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/library.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/metric.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/phase.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/prediction.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/project.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/quickstarter.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/round.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/run.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/runner.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/score.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/submission.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/submission_file.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/target.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/upload.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_domain/user.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_identifiers.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_pagination.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_resource.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/api/_types.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/cli.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/convert.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/download.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/init.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/quickstarter.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/setup.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/test.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/command/update_token.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/constants.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/container.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/dev/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/dev/cli.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/dev/phala.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/downloader.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/external/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/external/gitignorefile.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/external/humanfriendly.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/external/inflection.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/inline.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/monkey_patches.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/cloud_executor.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/runner.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/tracing.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/runner/types.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/store.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/tester.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_code_loader.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_execute.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_file.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/__init__.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/leaderboard.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/reward.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/runner.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/scoring.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/_module/submission.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/cli.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/unstructured/utils.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch/utils.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch-monkeypatch.pth +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/SOURCES.txt +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/dependency_links.txt +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/entry_points.txt +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/not-zip-safe +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/crunch_cli.egg-info/top_level.txt +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/setup.cfg +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/setup.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/tests/test_container.py +0 -0
- {crunch_cli-12.0.2 → crunch_cli-12.1.0}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crunch-cli
|
|
3
|
-
Version: 12.0
|
|
3
|
+
Version: 12.1.0
|
|
4
4
|
Summary: crunch-cli - CLI of the CrunchDAO Platform
|
|
5
5
|
Home-page: https://github.com/crunchdao/crunch-cli
|
|
6
6
|
Author: Enzo CACERES
|
|
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
11
11
|
Requires-Python: >=3
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: click
|
|
14
|
-
Requires-Dist: crunch-convert>=0.
|
|
14
|
+
Requires-Dist: crunch-convert>=0.12.1
|
|
15
15
|
Requires-Dist: crunch-encrypt
|
|
16
16
|
Requires-Dist: coloredlogs
|
|
17
17
|
Requires-Dist: dataclasses_json
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
__title__ = 'crunch-cli'
|
|
2
2
|
__description__ = 'crunch-cli - CLI of the CrunchDAO Platform'
|
|
3
|
-
__version__ = '12.0
|
|
3
|
+
__version__ = '12.1.0'
|
|
4
4
|
__author__ = 'Enzo CACERES'
|
|
5
5
|
__author_email__ = 'enzo.caceres@crunchdao.com'
|
|
6
6
|
__url__ = 'https://github.com/crunchdao/crunch-cli'
|
|
@@ -55,6 +55,7 @@ from crunch.api._errors import EncryptedSubmissionException as EncryptedSubmissi
|
|
|
55
55
|
from crunch.api._errors import ForbiddenLibraryException as ForbiddenLibraryException
|
|
56
56
|
from crunch.api._errors import InternalServerException as InternalServerException
|
|
57
57
|
from crunch.api._errors import InvalidProjectTokenException as InvalidProjectTokenException
|
|
58
|
+
from crunch.api._errors import InvalidRunTokenException as InvalidRunTokenException
|
|
58
59
|
from crunch.api._errors import LatestRoundNotFoundException as LatestRoundNotFoundException
|
|
59
60
|
from crunch.api._errors import LeaderboardNotFoundException as LeaderboardNotFoundException
|
|
60
61
|
from crunch.api._errors import MissingPhaseDataException as MissingPhaseDataException
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import sys
|
|
3
|
+
from dataclasses import dataclass
|
|
3
4
|
from typing import Any, Dict, List, Optional, Union
|
|
4
5
|
|
|
6
|
+
from dataclasses_json import DataClassJsonMixin
|
|
7
|
+
|
|
5
8
|
from crunch.api._domain.phase import PhaseType
|
|
6
9
|
from crunch.api._domain.project import ProjectTokenType
|
|
7
10
|
from crunch.external.humanfriendly import format_size
|
|
@@ -38,9 +41,6 @@ class ApiException(Exception):
|
|
|
38
41
|
|
|
39
42
|
class InternalServerException(ApiException):
|
|
40
43
|
|
|
41
|
-
def __init__(self, message: str):
|
|
42
|
-
super().__init__(message)
|
|
43
|
-
|
|
44
44
|
def print_helper(
|
|
45
45
|
self,
|
|
46
46
|
**kwargs: Any,
|
|
@@ -97,9 +97,6 @@ class ValidationFailedException(ApiException):
|
|
|
97
97
|
|
|
98
98
|
class CheckException(ApiException):
|
|
99
99
|
|
|
100
|
-
def __init__(self, message: str):
|
|
101
|
-
super().__init__(message)
|
|
102
|
-
|
|
103
100
|
def print_helper(
|
|
104
101
|
self,
|
|
105
102
|
**kwargs: Any,
|
|
@@ -180,12 +177,6 @@ class CrunchNotPublishedException(ApiException):
|
|
|
180
177
|
|
|
181
178
|
class CurrentPhaseNotFoundException(ApiException):
|
|
182
179
|
|
|
183
|
-
def __init__(
|
|
184
|
-
self,
|
|
185
|
-
message: str
|
|
186
|
-
):
|
|
187
|
-
super().__init__(message)
|
|
188
|
-
|
|
189
180
|
def print_helper(
|
|
190
181
|
self,
|
|
191
182
|
**kwargs: Any,
|
|
@@ -219,16 +210,25 @@ class DailySubmissionLimitExceededException(ApiException):
|
|
|
219
210
|
_print_contact("you should get more")
|
|
220
211
|
|
|
221
212
|
|
|
213
|
+
@dataclass
|
|
214
|
+
class ForbiddenRequirement(DataClassJsonMixin):
|
|
215
|
+
name: str
|
|
216
|
+
language: str
|
|
217
|
+
|
|
218
|
+
|
|
222
219
|
class ForbiddenLibraryException(ApiException):
|
|
223
220
|
|
|
224
221
|
def __init__(
|
|
225
222
|
self,
|
|
226
223
|
message: str,
|
|
227
|
-
|
|
224
|
+
requirements: List[dict[str, Any]]
|
|
228
225
|
):
|
|
229
226
|
super().__init__(message)
|
|
230
227
|
|
|
231
|
-
self.
|
|
228
|
+
self.requirements = [
|
|
229
|
+
ForbiddenRequirement.from_dict(item) # pyright: ignore[reportUnknownMemberType]
|
|
230
|
+
for item in requirements
|
|
231
|
+
]
|
|
232
232
|
|
|
233
233
|
def print_helper(
|
|
234
234
|
self,
|
|
@@ -245,16 +245,29 @@ class ForbiddenLibraryException(ApiException):
|
|
|
245
245
|
client = Client.from_env()
|
|
246
246
|
|
|
247
247
|
print("\nProblematic packages:")
|
|
248
|
-
for
|
|
249
|
-
print(f"- {
|
|
248
|
+
for requirement in self.requirements:
|
|
249
|
+
print(f"- {requirement.name}")
|
|
250
250
|
|
|
251
251
|
if competition_name is not None:
|
|
252
|
-
|
|
252
|
+
request_language_param = "&requestLanguage={requirement.language}" if requirement.language != "PYTHON" else ""
|
|
253
|
+
url = client.format_web_url(f'/competitions/{competition_name}/resources/whitelisted-libraries?requestName={requirement.name}{request_language_param}')
|
|
253
254
|
print(f" >> Request to whitelist: {url}")
|
|
254
255
|
|
|
255
256
|
_print_contact("the package should be allowed")
|
|
256
257
|
|
|
257
258
|
|
|
259
|
+
class RequirementParseError(ApiException):
|
|
260
|
+
|
|
261
|
+
def print_helper(
|
|
262
|
+
self,
|
|
263
|
+
**kwargs: Any,
|
|
264
|
+
) -> None:
|
|
265
|
+
print("There was an error while trying to parse your requirements file:")
|
|
266
|
+
|
|
267
|
+
for line in str(self.message).splitlines():
|
|
268
|
+
print(f" {line}")
|
|
269
|
+
|
|
270
|
+
|
|
258
271
|
class InvalidProjectTokenException(ApiException):
|
|
259
272
|
|
|
260
273
|
def __init__(
|
|
@@ -353,9 +366,6 @@ class ModelTooBigException(ApiException):
|
|
|
353
366
|
|
|
354
367
|
class NeverSubmittedException(ApiException):
|
|
355
368
|
|
|
356
|
-
def __init__(self, message: str):
|
|
357
|
-
super().__init__(message)
|
|
358
|
-
|
|
359
369
|
def print_helper(
|
|
360
370
|
self,
|
|
361
371
|
**kwargs: Any,
|
|
@@ -365,9 +375,6 @@ class NeverSubmittedException(ApiException):
|
|
|
365
375
|
|
|
366
376
|
class EncryptedSubmissionException(ApiException):
|
|
367
377
|
|
|
368
|
-
def __init__(self, message: str):
|
|
369
|
-
super().__init__(message)
|
|
370
|
-
|
|
371
378
|
def print_helper(
|
|
372
379
|
self,
|
|
373
380
|
**kwargs: Any,
|
|
@@ -377,12 +384,6 @@ class EncryptedSubmissionException(ApiException):
|
|
|
377
384
|
|
|
378
385
|
class PredictionSubmissionNotAllowedException(ApiException):
|
|
379
386
|
|
|
380
|
-
def __init__(
|
|
381
|
-
self,
|
|
382
|
-
message: str,
|
|
383
|
-
):
|
|
384
|
-
super().__init__(message)
|
|
385
|
-
|
|
386
387
|
def print_helper(
|
|
387
388
|
self,
|
|
388
389
|
**kwargs: Any,
|
|
@@ -707,6 +708,18 @@ LatestRoundNotFoundException = RoundNotFoundException
|
|
|
707
708
|
NextRoundNotFoundException = RoundNotFoundException
|
|
708
709
|
|
|
709
710
|
|
|
711
|
+
class InvalidRunTokenException(ApiException):
|
|
712
|
+
|
|
713
|
+
def __init__(
|
|
714
|
+
self,
|
|
715
|
+
message: str,
|
|
716
|
+
run_id: int,
|
|
717
|
+
):
|
|
718
|
+
super().__init__(message)
|
|
719
|
+
|
|
720
|
+
self.run_id = run_id
|
|
721
|
+
|
|
722
|
+
|
|
710
723
|
def convert_error(
|
|
711
724
|
response: Dict[str, Any]
|
|
712
725
|
):
|
|
@@ -245,10 +245,14 @@ def _upload_files(
|
|
|
245
245
|
with open(path, "r") as fd:
|
|
246
246
|
original_requirements_file = fd.read()
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
try:
|
|
249
|
+
requirements = requirements_txt.parse_from_file(
|
|
250
|
+
language=language,
|
|
251
|
+
file_content=original_requirements_file,
|
|
252
|
+
)
|
|
253
|
+
except requirements_txt.RequirementParseError as error:
|
|
254
|
+
print(f"{language.txt_file_name}: {error}")
|
|
255
|
+
raise click.Abort()
|
|
252
256
|
|
|
253
257
|
whitelist = requirements_txt.CachedWhitelist(
|
|
254
258
|
requirements_txt.CrunchHubWhitelist(
|
|
@@ -5,9 +5,10 @@ from collections import defaultdict
|
|
|
5
5
|
from types import ModuleType
|
|
6
6
|
from typing import Any, Dict, List, NamedTuple, Optional, Set, overload
|
|
7
7
|
|
|
8
|
+
import click
|
|
8
9
|
from crunch_convert import RequirementLanguage
|
|
9
10
|
from crunch_convert.notebook import BadCellHandling, extract_from_cells
|
|
10
|
-
from crunch_convert.requirements_txt import CachedWhitelist, CrunchHubWhitelist, MultipleLibraryAliasCandidateException, Whitelist, parse_from_file
|
|
11
|
+
from crunch_convert.requirements_txt import CachedWhitelist, CrunchHubWhitelist, MultipleLibraryAliasCandidateException, RequirementParseError, Whitelist, parse_from_file
|
|
11
12
|
|
|
12
13
|
import crunch.store as store
|
|
13
14
|
from crunch.api import Client
|
|
@@ -37,16 +38,22 @@ def extract_from_requirements(
|
|
|
37
38
|
return set()
|
|
38
39
|
|
|
39
40
|
with open(file_path, "r") as fd:
|
|
41
|
+
file_content = fd.read()
|
|
42
|
+
|
|
43
|
+
try:
|
|
40
44
|
requirements = parse_from_file(
|
|
41
45
|
language=language,
|
|
42
|
-
file_content=
|
|
46
|
+
file_content=file_content,
|
|
43
47
|
)
|
|
48
|
+
except RequirementParseError as error:
|
|
49
|
+
print(f"{language.txt_file_name}: {error}")
|
|
50
|
+
raise click.Abort()
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
return {
|
|
53
|
+
requirement.name
|
|
54
|
+
for requirement in requirements
|
|
55
|
+
if requirement.language == language
|
|
56
|
+
}
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
def extract_from_notebook_modules(
|
|
@@ -18,12 +18,12 @@ import requests
|
|
|
18
18
|
|
|
19
19
|
import crunch.store as store
|
|
20
20
|
import requirements as requirements_parser
|
|
21
|
-
from crunch.api import Client, Competition, Language, ModelTooBigException, PhaseType, PredictionTooBigException, RunnerRun, Upload
|
|
21
|
+
from crunch.api import Client, Competition, InvalidRunTokenException, Language, ModelTooBigException, PhaseType, PredictionTooBigException, RunnerRun, Upload
|
|
22
22
|
from crunch.downloader import prepare_all, save_all
|
|
23
23
|
from crunch.runner.runner import Runner
|
|
24
24
|
from crunch.runner.tracing import GpuPresence, RemoteTraceExporter, RunnerTracer, to_execute_span_attributes
|
|
25
25
|
from crunch.runner.types import KwargsLike
|
|
26
|
-
from crunch.runner.unstructured import RunnerContext
|
|
26
|
+
from crunch.runner.unstructured import DEFAULT_LOG_LIMITS, RunnerContext
|
|
27
27
|
from crunch.unstructured import LocalCodeLoader, RunnerModule, deduce_code_loader
|
|
28
28
|
from crunch.utils import download
|
|
29
29
|
|
|
@@ -166,8 +166,12 @@ class CloudRunner(Runner):
|
|
|
166
166
|
|
|
167
167
|
self._download_runner()
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
try:
|
|
170
|
+
code_file_urls = self.run.code
|
|
171
|
+
model_file_urls = self.run.model
|
|
172
|
+
except InvalidRunTokenException:
|
|
173
|
+
self.log("invalid run token", error=True)
|
|
174
|
+
exit(1)
|
|
171
175
|
|
|
172
176
|
if "install r requirements":
|
|
173
177
|
requirements_r_txt_name = "requirements.r.txt"
|
|
@@ -597,6 +601,8 @@ class CloudRunner(Runner):
|
|
|
597
601
|
command: str,
|
|
598
602
|
parameters: KwargsLike = {},
|
|
599
603
|
install_data_fuse: bool = True,
|
|
604
|
+
prefix_head: int = DEFAULT_LOG_LIMITS[0],
|
|
605
|
+
prefix_tail: int = DEFAULT_LOG_LIMITS[1],
|
|
600
606
|
) -> None:
|
|
601
607
|
(
|
|
602
608
|
trace_file_path,
|
|
@@ -671,7 +677,7 @@ class CloudRunner(Runner):
|
|
|
671
677
|
"--chown-directory", self.model_directory_path,
|
|
672
678
|
"--filter-non-unix-socket-syscall",
|
|
673
679
|
"--",
|
|
674
|
-
"prefix", "user-code",
|
|
680
|
+
"prefix", f"--head={prefix_head}", f"--tail={prefix_tail}", "user-code",
|
|
675
681
|
"--",
|
|
676
682
|
"python3", "-u",
|
|
677
683
|
"-m", "crunch", "runner", "cloud-executor",
|
|
@@ -966,6 +972,7 @@ class CloudRunnerContext(RunnerContext):
|
|
|
966
972
|
span_hidden_parameters: Optional[List[str]] = None,
|
|
967
973
|
span_attributes: Optional[KwargsLike] = None,
|
|
968
974
|
install_data_fuse: bool = True,
|
|
975
|
+
log_limits: Tuple[int, int] = DEFAULT_LOG_LIMITS,
|
|
969
976
|
) -> None:
|
|
970
977
|
self.log(f"executing - command={command}")
|
|
971
978
|
|
|
@@ -976,4 +983,6 @@ class CloudRunnerContext(RunnerContext):
|
|
|
976
983
|
command,
|
|
977
984
|
parameters=parameters or {},
|
|
978
985
|
install_data_fuse=install_data_fuse,
|
|
986
|
+
prefix_head=log_limits[0],
|
|
987
|
+
prefix_tail=log_limits[1],
|
|
979
988
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
3
|
import time
|
|
4
|
-
from typing import Any, List, Literal, Optional
|
|
4
|
+
from typing import Any, List, Literal, Optional, Tuple
|
|
5
5
|
|
|
6
6
|
import click
|
|
7
7
|
|
|
@@ -214,7 +214,8 @@ class LocalRunnerContext(RunnerContext):
|
|
|
214
214
|
trace: bool = True,
|
|
215
215
|
span_hidden_parameters: Optional[List[str]] = None,
|
|
216
216
|
span_attributes: Optional[KwargsLike] = None,
|
|
217
|
-
install_data_fuse: bool = True,
|
|
217
|
+
install_data_fuse: bool = True, # unavailable locally
|
|
218
|
+
log_limits: Tuple[int, int] = (0, 0), # unavailable locally
|
|
218
219
|
) -> None:
|
|
219
220
|
self.log(f"executing - command={command}")
|
|
220
221
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from datetime import datetime, timedelta
|
|
3
3
|
from types import ModuleType
|
|
4
|
-
from typing import Any, Callable, List, Literal, Optional
|
|
4
|
+
from typing import Any, Callable, List, Literal, Optional, Tuple
|
|
5
5
|
|
|
6
6
|
from crunch.runner.types import KwargsLike
|
|
7
7
|
|
|
8
|
+
DEFAULT_LOG_LIMITS: Tuple[int, int] = (1000, 500)
|
|
9
|
+
|
|
8
10
|
|
|
9
11
|
class RunnerContext(ABC):
|
|
10
12
|
|
|
@@ -102,6 +104,7 @@ class RunnerContext(ABC):
|
|
|
102
104
|
span_hidden_parameters: Optional[List[str]] = None,
|
|
103
105
|
span_attributes: Optional[KwargsLike] = None,
|
|
104
106
|
install_data_fuse: bool = True,
|
|
107
|
+
log_limits: Tuple[int, int] = DEFAULT_LOG_LIMITS,
|
|
105
108
|
) -> None:
|
|
106
109
|
"""
|
|
107
110
|
Execute a command.
|
|
@@ -113,6 +116,7 @@ class RunnerContext(ABC):
|
|
|
113
116
|
span_hidden_parameters (Optional[List[str]]): The parameters to hide from the span (e.g., contain useless information).
|
|
114
117
|
span_attributes (Optional[KwargsLike]): Additional attributes to merge with the span's attributes.
|
|
115
118
|
install_data_fuse (bool): Whether to temporarily allow data access, which is only restricted after the data fuse is tripped. If disabled, no data access is ever permitted and triggering the fuse has no effect.
|
|
119
|
+
log_limits (Tuple[int, int]): The logging output limits are as follows: the first limit is the number of lines as the head and the second limit is the number of lines as the tail. Everything in between will be lost. This is only used in a cloud environment.
|
|
116
120
|
|
|
117
121
|
Returns:
|
|
118
122
|
None: This function does not return anything.
|
|
@@ -136,6 +140,7 @@ class RunnerExecutorContext(ABC):
|
|
|
136
140
|
|
|
137
141
|
_sentinel = object()
|
|
138
142
|
|
|
143
|
+
|
|
139
144
|
class UserModule(ABC):
|
|
140
145
|
|
|
141
146
|
def get_function(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crunch-cli
|
|
3
|
-
Version: 12.0
|
|
3
|
+
Version: 12.1.0
|
|
4
4
|
Summary: crunch-cli - CLI of the CrunchDAO Platform
|
|
5
5
|
Home-page: https://github.com/crunchdao/crunch-cli
|
|
6
6
|
Author: Enzo CACERES
|
|
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
11
11
|
Requires-Python: >=3
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: click
|
|
14
|
-
Requires-Dist: crunch-convert>=0.
|
|
14
|
+
Requires-Dist: crunch-convert>=0.12.1
|
|
15
15
|
Requires-Dist: crunch-encrypt
|
|
16
16
|
Requires-Dist: coloredlogs
|
|
17
17
|
Requires-Dist: dataclasses_json
|
|
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
|