openbayes-cli 0.5.0__tar.gz → 0.7.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.
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/PKG-INFO +1 -1
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/gear.py +2 -1
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/auth_usecase.py +32 -5
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/pyproject.toml +1 -1
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/README.md +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/base.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/dataset_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/dataset_list_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/dataset_upload_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/dataset_version_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/gear_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/job_run_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/minio_storage_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/org_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/resource_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/runtime_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/ssh_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/status_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/client/user_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/data.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/hpc.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/org.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/commands/ssh.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/error.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/dataset.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/dataset_version.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/bayes_file.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/data_bindings.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/openbayes_gear.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/openbayes_ignore.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/openbayes_yaml.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/file/settings.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/party.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/resource.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/model/runtime.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/root.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/templates/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/templates/openbayes_zh-Hans.yaml +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/templates/openbayesignore.yaml +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/archive_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/dataset_list_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/dataset_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/dataset_version_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/disk_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/gear_download_usecese.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/gear_logs_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/gear_run_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/gear_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/minio_storage_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/open_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/org_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/resource_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/runtime_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/ssh_usecase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/switch_usercase.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/usercases/upload_state_manager.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/bayes/utils.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/__init__.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/config.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/http_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/jwt_client.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/tracker.py +0 -0
- {openbayes_cli-0.5.0 → openbayes_cli-0.7.0}/openbayestool/updater.py +0 -0
|
@@ -17,7 +17,8 @@ app = typer.Typer()
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@app.command()
|
|
20
|
-
def init(ctx: typer.Context,
|
|
20
|
+
def init(ctx: typer.Context,
|
|
21
|
+
id_or_name: str = typer.Argument(None, envvar="OPENBAYES_JOB_PROJECT", help="容器 ID 或名称"),
|
|
21
22
|
message: str = typer.Option(None, "-m", "--message", help="容器描述"),
|
|
22
23
|
open: bool = typer.Option(False, "-o", "--open", help="成功初始化容器后,在浏览器打开")):
|
|
23
24
|
"""
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from typing import Optional
|
|
2
3
|
|
|
3
4
|
import typer
|
|
@@ -14,23 +15,49 @@ def get_default_credential_userinfo():
|
|
|
14
15
|
|
|
15
16
|
if not default_env.token:
|
|
16
17
|
print("用户还未登陆")
|
|
17
|
-
return
|
|
18
|
+
return None
|
|
19
|
+
|
|
18
20
|
try:
|
|
19
21
|
login_model = user_client.login_with_token(gql_client, default_env.token)
|
|
22
|
+
# 登陆成功,获得用户信息,去修改文件
|
|
23
|
+
BayesSettings().login(login_model.username, login_model.token)
|
|
24
|
+
return login_model
|
|
20
25
|
except Error as e:
|
|
21
26
|
print("登陆失败,请重新使用密码或者新的令牌登录")
|
|
22
27
|
raise typer.Exit(code=1)
|
|
23
|
-
# 登陆成功,获得用户信息,去修改文件
|
|
24
|
-
BayesSettings().login(login_model.username, login_model.token)
|
|
25
|
-
return login_model
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
def check_login():
|
|
29
31
|
default_env: Optional[BayesEnvConfig] = BayesSettings().default_env
|
|
32
|
+
gql_client = BayesGQLClient(default_env.graphQL, None)
|
|
33
|
+
|
|
34
|
+
# 检查是否已登录
|
|
30
35
|
if default_env.name and default_env.token:
|
|
31
36
|
return True
|
|
32
|
-
|
|
37
|
+
|
|
38
|
+
# 从环境变量获取信息
|
|
39
|
+
token = os.getenv("OPENBAYES_TOKEN")
|
|
40
|
+
org = os.getenv("OPENBAYES_ORG")
|
|
41
|
+
user = os.getenv("OPENBAYES_USER")
|
|
42
|
+
|
|
43
|
+
if not token:
|
|
33
44
|
return False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
login_model = user_client.login_with_token(gql_client, token)
|
|
48
|
+
# 登陆成功,获得用户信息,去修改文件
|
|
49
|
+
BayesSettings().login(login_model.username, login_model.token)
|
|
50
|
+
|
|
51
|
+
# 更新 orgName
|
|
52
|
+
if org and user:
|
|
53
|
+
if org == user:
|
|
54
|
+
default_env.orgName = ""
|
|
55
|
+
else:
|
|
56
|
+
default_env.orgName = org
|
|
57
|
+
return True
|
|
58
|
+
except Error as e:
|
|
59
|
+
print("登陆失败,请重新使用密码或者新的令牌登录")
|
|
60
|
+
raise typer.Exit(code=1)
|
|
34
61
|
|
|
35
62
|
|
|
36
63
|
def is_working_on_org():
|
|
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
|