cycls 0.0.2.94__py3-none-any.whl → 0.0.2.95__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.
- cycls/function.py +33 -1
- {cycls-0.0.2.94.dist-info → cycls-0.0.2.95.dist-info}/METADATA +1 -1
- {cycls-0.0.2.94.dist-info → cycls-0.0.2.95.dist-info}/RECORD +5 -5
- {cycls-0.0.2.94.dist-info → cycls-0.0.2.95.dist-info}/WHEEL +0 -0
- {cycls-0.0.2.94.dist-info → cycls-0.0.2.95.dist-info}/entry_points.txt +0 -0
cycls/function.py
CHANGED
|
@@ -399,7 +399,30 @@ CMD ["python", "entrypoint.py"]
|
|
|
399
399
|
def _deploy(self, *args, **kwargs):
|
|
400
400
|
import requests
|
|
401
401
|
|
|
402
|
+
base_url = self.base_url
|
|
402
403
|
port = kwargs.pop('port', 8080)
|
|
404
|
+
|
|
405
|
+
# Check name availability before uploading
|
|
406
|
+
print(f"Checking '{self.name}'...")
|
|
407
|
+
try:
|
|
408
|
+
check_resp = requests.get(
|
|
409
|
+
f"{base_url}/v1/deployment/check-name",
|
|
410
|
+
params={"name": self.name},
|
|
411
|
+
headers={"X-API-Key": self.api_key},
|
|
412
|
+
timeout=30,
|
|
413
|
+
)
|
|
414
|
+
if check_resp.status_code == 401:
|
|
415
|
+
print("Error: Invalid API key")
|
|
416
|
+
return None
|
|
417
|
+
check_resp.raise_for_status()
|
|
418
|
+
check_data = check_resp.json()
|
|
419
|
+
if not check_data.get("available"):
|
|
420
|
+
print(f"Error: {check_data.get('reason', 'Name unavailable')}")
|
|
421
|
+
return None
|
|
422
|
+
except requests.exceptions.RequestException as e:
|
|
423
|
+
print(f"Error checking name: {e}")
|
|
424
|
+
return None
|
|
425
|
+
|
|
403
426
|
print(f"Deploying '{self.name}'...")
|
|
404
427
|
|
|
405
428
|
payload = cloudpickle.dumps((self.func, args, {**kwargs, 'port': port}))
|
|
@@ -418,7 +441,7 @@ CMD ["python", "entrypoint.py"]
|
|
|
418
441
|
print("Uploading...")
|
|
419
442
|
with open(archive_path, 'rb') as f:
|
|
420
443
|
response = requests.post(
|
|
421
|
-
"
|
|
444
|
+
f"{base_url}/v1/deploy",
|
|
422
445
|
data={"function_name": self.name, "port": port},
|
|
423
446
|
files={'source_archive': (archive_name, f, 'application/gzip')},
|
|
424
447
|
headers={"X-API-Key": self.api_key},
|
|
@@ -426,6 +449,14 @@ CMD ["python", "entrypoint.py"]
|
|
|
426
449
|
stream=True,
|
|
427
450
|
)
|
|
428
451
|
|
|
452
|
+
if not response.ok:
|
|
453
|
+
print(f"Deploy failed: {response.status_code}")
|
|
454
|
+
try:
|
|
455
|
+
print(f" {response.json()['detail']}")
|
|
456
|
+
except (json.JSONDecodeError, KeyError):
|
|
457
|
+
print(f" {response.text}")
|
|
458
|
+
return None
|
|
459
|
+
|
|
429
460
|
# Parse NDJSON stream
|
|
430
461
|
url = None
|
|
431
462
|
for line in response.iter_lines(decode_unicode=True):
|
|
@@ -436,6 +467,7 @@ CMD ["python", "entrypoint.py"]
|
|
|
436
467
|
print(f" [{status}] {msg}")
|
|
437
468
|
if status == "DONE":
|
|
438
469
|
url = event.get("url")
|
|
470
|
+
print(f"Deployed: {url}")
|
|
439
471
|
elif status == "ERROR":
|
|
440
472
|
return None
|
|
441
473
|
return url
|
|
@@ -2,14 +2,14 @@ cycls/__init__.py,sha256=efbq0vRijGOByKtz9bRF8WQFYmnPSgZV1DH-54s6iwQ,493
|
|
|
2
2
|
cycls/app.py,sha256=1i0cZ6EeSJMpSrB_qUtc7TxWjqcFrtwF7owbWBKpI0I,3547
|
|
3
3
|
cycls/auth.py,sha256=xkndHZyCfnlertMMEKerCJjf23N3fVcTRVTTSXTTuzg,247
|
|
4
4
|
cycls/cli.py,sha256=cVbIkTDnVofohvByyYUrXF_RYDQZVQECJqo7cPBPJfs,4781
|
|
5
|
-
cycls/function.py,sha256
|
|
5
|
+
cycls/function.py,sha256=sN1ekPBvGqK6B0N4D-HgybAOFNTcwtP2POdun2Ab2DQ,17793
|
|
6
6
|
cycls/state.py,sha256=3RL_BqcbfiAkJ6byeEo4Q9L99VurYyYKYJJhJhEVmAo,210
|
|
7
7
|
cycls/web.py,sha256=v-hyWL9nlh4SyqAVgRzOkx96YuBntxqw6Q6phpAMDv0,6172
|
|
8
8
|
cycls/themes/default/index.html,sha256=bZ3hJ4gPpDv9Jk2m2Eo8AaPAnf-96CE7LyvL5FJNl5Y,1082
|
|
9
9
|
cycls/themes/default/assets/index-CTZe1T7l.js,sha256=srbFzhFFHhllhr9ewEbtDWp0oRt9aDAmeeAsTlltO9g,1357164
|
|
10
10
|
cycls/themes/default/assets/index-oGkkm3Z8.css,sha256=xHhbrJvvz8mIN_Otrl6nawKJcA41L3tCFhVEOstGhVU,6498
|
|
11
11
|
cycls/themes/dev/index.html,sha256=QJBHkdNuMMiwQU7o8dN8__8YQeQB45D37D-NCXIWB2Q,11585
|
|
12
|
-
cycls-0.0.2.
|
|
13
|
-
cycls-0.0.2.
|
|
14
|
-
cycls-0.0.2.
|
|
15
|
-
cycls-0.0.2.
|
|
12
|
+
cycls-0.0.2.95.dist-info/METADATA,sha256=0LmWLR7e998B9-qBrBxwTtlc4CvzFH-gHOV8nd9yrCo,8869
|
|
13
|
+
cycls-0.0.2.95.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
cycls-0.0.2.95.dist-info/entry_points.txt,sha256=CktT5eNvW_Qxomf7L_Ez_GdUbL6qAfx_Utm6_HtUJwE,41
|
|
15
|
+
cycls-0.0.2.95.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|