openbayes-cli 0.28.0__tar.gz → 0.28.2__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.
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/PKG-INFO +2 -2
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/minio_storage_usecase.py +42 -20
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/pyproject.toml +2 -2
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/README.md +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/base.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/dataset_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/dataset_list_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/dataset_upload_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/dataset_version_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/gear_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/job_run_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/minio_storage_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/org_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/resource_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/runtime_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/ssh_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/status_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/client/user_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/data.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/gear.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/hpc.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/org.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/commands/ssh.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/error.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/dataset.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/dataset_version.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/bayes_file.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/data_bindings.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/openbayes_gear.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/openbayes_ignore.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/openbayes_yaml.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/file/settings.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/party.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/resource.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/model/runtime.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/root.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/templates/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/templates/openbayes_zh-Hans.yaml +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/templates/openbayesignore.yaml +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/archive_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/auth_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/dataset_list_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/dataset_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/dataset_version_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/disk_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/gear_download_usecese.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/gear_logs_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/gear_run_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/gear_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/open_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/org_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/resource_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/runtime_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/ssh_usecase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/switch_usercase.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/usercases/upload_state_manager.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/utils/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/utils/add_global_param.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/bayes/utils.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/__init__.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/config.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/http_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/jwt_client.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/tracker.py +0 -0
- {openbayes_cli-0.28.0 → openbayes_cli-0.28.2}/openbayestool/updater.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openbayes-cli
|
|
3
|
-
Version: 0.28.
|
|
3
|
+
Version: 0.28.2
|
|
4
4
|
Summary: A Python CLI for OpenBayes
|
|
5
5
|
License: OpenBayes Public Source License
|
|
6
6
|
Keywords: openbayes,cli,machine learning
|
|
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
21
|
Requires-Dist: aiohttp (>=3.10.2,<4.0.0)
|
|
22
22
|
Requires-Dist: archiver (>=0.2.2,<0.3.0)
|
|
23
|
-
Requires-Dist: boto3 (>=1.35,<
|
|
23
|
+
Requires-Dist: boto3 (>=1.35,<1.43)
|
|
24
24
|
Requires-Dist: click (>=8.1.7,<9)
|
|
25
25
|
Requires-Dist: gql (>=3.5.0,<4.0.0)
|
|
26
26
|
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
|
@@ -134,16 +134,27 @@ class ProgressPercentage:
|
|
|
134
134
|
_S3_CLIENT_TO_SESSION = {}
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
def _build_s3_client(endpoint: str, access_key: str, secret_key: str):
|
|
138
|
-
|
|
139
|
-
# 重要:为避免网络抖动/链接半断时“无限等待”,显式设置超时。
|
|
140
|
-
# connect_timeout:建立连接的最长等待
|
|
141
|
-
# read_timeout:等待服务端响应的最长等待(上传分片后服务端返回 ETag)
|
|
142
|
-
config = BotoCoreConfig(
|
|
137
|
+
def _build_s3_client(endpoint: str, access_key: str, secret_key: str, read_timeout: int = 900):
|
|
138
|
+
config_kwargs = dict(
|
|
143
139
|
retries={"max_attempts": 10, "mode": "adaptive"},
|
|
144
140
|
connect_timeout=10,
|
|
145
|
-
read_timeout=
|
|
141
|
+
read_timeout=read_timeout,
|
|
146
142
|
)
|
|
143
|
+
# botocore >= 1.36 默认 request_checksum_calculation="when_supported", 会给
|
|
144
|
+
# PutObject / UploadPart 自动附加 CRC32 校验和。在 HTTPS 的 S3 端点上, 这会让请求体
|
|
145
|
+
# 退化为 aws-chunked 流式上传 (X-Amz-Content-SHA256: STREAMING-UNSIGNED-PAYLOAD-TRAILER),
|
|
146
|
+
# 不再发送 Content-Length。许多 S3 兼容后端 (MinIO/Ceph 等) 不支持该模式, 会以
|
|
147
|
+
# MissingContentLength ("You must provide the Content-Length HTTP header") 拒绝上传。
|
|
148
|
+
# 这里显式退回 when_required 行为, 保证普通的带 Content-Length 的 PUT。
|
|
149
|
+
# 注意: 该参数在 botocore < 1.36 上不存在, 传入会抛 TypeError, 故做向后兼容降级。
|
|
150
|
+
try:
|
|
151
|
+
config = BotoCoreConfig(
|
|
152
|
+
request_checksum_calculation="when_required",
|
|
153
|
+
response_checksum_validation="when_required",
|
|
154
|
+
**config_kwargs,
|
|
155
|
+
)
|
|
156
|
+
except TypeError:
|
|
157
|
+
config = BotoCoreConfig(**config_kwargs)
|
|
147
158
|
return boto3.client(
|
|
148
159
|
"s3",
|
|
149
160
|
endpoint_url=endpoint,
|
|
@@ -911,15 +922,26 @@ def upload_file_with_resume(s3_client, bucket_name, local_file_path, remote_file
|
|
|
911
922
|
)
|
|
912
923
|
|
|
913
924
|
# 完成分块上传
|
|
914
|
-
print("\n
|
|
915
|
-
print(
|
|
916
|
-
f"提示:这个步骤不会增加上传字节数,所以进度条可能看起来“不动”。"
|
|
917
|
-
f"服务端会进行对象完成/元数据写入与校验。"
|
|
918
|
-
f"(本次分片数:{total_parts},分片大小:{_format_bytes_binary(part_size)},约 {filesize.decimal(part_size)})"
|
|
919
|
-
)
|
|
925
|
+
print("\n所有分块已上传,正在请求服务端完成合并...")
|
|
920
926
|
completed_parts.sort(key=lambda x: x['PartNumber'])
|
|
927
|
+
|
|
928
|
+
# complete_multipart_upload 是纯元数据操作(body 极小),正常只需几秒。
|
|
929
|
+
# 但分片上传期间 TCP 连接可能已被 NAT/网关静默关掉,boto3 不知道还在傻等。
|
|
930
|
+
# 如果复用 read_timeout=900 的 client,要干等 15 分钟才超时。
|
|
931
|
+
# 解决:有 session 时用短超时(60s)的新 client,连接死了快速重试而非死等。
|
|
932
|
+
# (无 session 是 source code 上传路径,文件都很小,几乎不会走到这里,复用原 client 即可。)
|
|
933
|
+
_complete_client = (
|
|
934
|
+
_build_s3_client(
|
|
935
|
+
session.policy.endpoint,
|
|
936
|
+
session.policy.accessKey,
|
|
937
|
+
session.policy.secretKey,
|
|
938
|
+
read_timeout=60,
|
|
939
|
+
)
|
|
940
|
+
if session
|
|
941
|
+
else s3_client
|
|
942
|
+
)
|
|
921
943
|
_call_with_retry(
|
|
922
|
-
|
|
944
|
+
_complete_client,
|
|
923
945
|
lambda c: c.complete_multipart_upload(
|
|
924
946
|
Bucket=bucket_name,
|
|
925
947
|
Key=remote_file_path,
|
|
@@ -927,6 +949,8 @@ def upload_file_with_resume(s3_client, bucket_name, local_file_path, remote_file
|
|
|
927
949
|
MultipartUpload={'Parts': completed_parts},
|
|
928
950
|
),
|
|
929
951
|
session=session,
|
|
952
|
+
max_attempts=8,
|
|
953
|
+
initial_backoff=1.0,
|
|
930
954
|
)
|
|
931
955
|
|
|
932
956
|
# 关闭进度条
|
|
@@ -966,12 +990,10 @@ def upload_source_code(party_name: str, source_code_path: str, storageType: str)
|
|
|
966
990
|
print("正在获取上传授权...")
|
|
967
991
|
policy = get_source_code_upload_policy(party_name, storageType)
|
|
968
992
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
aws_secret_access_key=policy.secretKey
|
|
974
|
-
)
|
|
993
|
+
# 复用 _build_s3_client, 确保源代码上传也带上 when_required 校验和配置;
|
|
994
|
+
# 否则 botocore >= 1.36 在 HTTPS 端点下会退化为 aws-chunked, 丢失 Content-Length,
|
|
995
|
+
# 导致 MinIO/Ceph 后端以 MissingContentLength 拒绝上传。
|
|
996
|
+
s3_client = _build_s3_client(policy.endpoint, policy.accessKey, policy.secretKey)
|
|
975
997
|
|
|
976
998
|
bucket_name, minio_path = extract_bucket_and_path(policy.path)
|
|
977
999
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "openbayes-cli"
|
|
3
|
-
version = "0.28.
|
|
3
|
+
version = "0.28.2"
|
|
4
4
|
description = "A Python CLI for OpenBayes"
|
|
5
5
|
authors = ["OpenBayes <dev@openbayes.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -46,7 +46,7 @@ tuspy = "^1.0.3"
|
|
|
46
46
|
tqdm = "^4.66.5"
|
|
47
47
|
toml = "^0.10.2"
|
|
48
48
|
pydantic = "^2.9.2"
|
|
49
|
-
boto3 = "
|
|
49
|
+
boto3 = ">=1.35,<1.43"
|
|
50
50
|
|
|
51
51
|
[tool.poetry.group.dev.dependencies]
|
|
52
52
|
pytest = "^8.2.2"
|
|
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
|