openbayes-cli 0.7.0__tar.gz → 0.8.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.
Files changed (69) hide show
  1. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/PKG-INFO +1 -1
  2. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/data.py +7 -7
  3. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/gear.py +20 -15
  4. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/hpc.py +13 -13
  5. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/org.py +3 -3
  6. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/settings.py +7 -0
  7. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/root.py +1 -0
  8. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/auth_usecase.py +10 -9
  9. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/pyproject.toml +1 -1
  10. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/README.md +0 -0
  11. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/__init__.py +0 -0
  12. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/__init__.py +0 -0
  13. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/base.py +0 -0
  14. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/dataset_client.py +0 -0
  15. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/dataset_list_client.py +0 -0
  16. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/dataset_upload_client.py +0 -0
  17. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/dataset_version_client.py +0 -0
  18. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/gear_client.py +0 -0
  19. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/job_run_client.py +0 -0
  20. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/minio_storage_client.py +0 -0
  21. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/org_client.py +0 -0
  22. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/resource_client.py +0 -0
  23. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/runtime_client.py +0 -0
  24. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/ssh_client.py +0 -0
  25. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/status_client.py +0 -0
  26. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/client/user_client.py +0 -0
  27. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/__init__.py +0 -0
  28. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/commands/ssh.py +0 -0
  29. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/error.py +0 -0
  30. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/__init__.py +0 -0
  31. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/dataset.py +0 -0
  32. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/dataset_version.py +0 -0
  33. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/__init__.py +0 -0
  34. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/bayes_file.py +0 -0
  35. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/data_bindings.py +0 -0
  36. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/openbayes_gear.py +0 -0
  37. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/openbayes_ignore.py +0 -0
  38. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/file/openbayes_yaml.py +0 -0
  39. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/party.py +0 -0
  40. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/resource.py +0 -0
  41. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/model/runtime.py +0 -0
  42. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/templates/__init__.py +0 -0
  43. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/templates/openbayes_zh-Hans.yaml +0 -0
  44. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/templates/openbayesignore.yaml +0 -0
  45. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/__init__.py +0 -0
  46. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/archive_usecase.py +0 -0
  47. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/dataset_list_usecase.py +0 -0
  48. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/dataset_usecase.py +0 -0
  49. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/dataset_version_usecase.py +0 -0
  50. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/disk_usecase.py +0 -0
  51. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/gear_download_usecese.py +0 -0
  52. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/gear_logs_usecase.py +0 -0
  53. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/gear_run_usecase.py +0 -0
  54. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/gear_usecase.py +0 -0
  55. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/minio_storage_usecase.py +0 -0
  56. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/open_usecase.py +0 -0
  57. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/org_usecase.py +0 -0
  58. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/resource_usecase.py +0 -0
  59. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/runtime_usecase.py +0 -0
  60. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/ssh_usecase.py +0 -0
  61. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/switch_usercase.py +0 -0
  62. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/usercases/upload_state_manager.py +0 -0
  63. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/bayes/utils.py +0 -0
  64. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/__init__.py +0 -0
  65. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/config.py +0 -0
  66. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/http_client.py +0 -0
  67. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/jwt_client.py +0 -0
  68. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/tracker.py +0 -0
  69. {openbayes_cli-0.7.0 → openbayes_cli-0.8.0}/openbayestool/updater.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openbayes-cli
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: A Python CLI for OpenBayes
5
5
  License: OpenBayes Public Source License
6
6
  Keywords: openbayes,cli,machine learning
@@ -3,7 +3,7 @@ from typing import Optional
3
3
 
4
4
  import typer
5
5
 
6
- from bayes.model.file.settings import BayesEnvConfig
6
+ from bayes.model.file.settings import BayesEnvConfig, BayesSettings
7
7
  from bayes.usercases import auth_usecase, dataset_list_usecase, dataset_usecase, open_usecase, minio_storage_usecase
8
8
 
9
9
  app = typer.Typer()
@@ -34,7 +34,7 @@ def create(ctx: typer.Context,
34
34
  print("尚未授权,请先登录")
35
35
  raise typer.Exit(code=1)
36
36
  # 检查现在是处于 组织/用户 状态
37
- bayes_settings = ctx.obj
37
+ bayes_settings = BayesSettings()
38
38
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
39
39
 
40
40
  party_name = ""
@@ -78,7 +78,7 @@ def new_version(ctx: typer.Context,
78
78
  print("尚未授权,请先登录")
79
79
  raise typer.Exit(code=1)
80
80
  # 检查现在是处于 组织/用户 状态
81
- bayes_settings = ctx.obj
81
+ bayes_settings = BayesSettings()
82
82
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
83
83
 
84
84
  party_name = ""
@@ -137,7 +137,7 @@ def upload(ctx: typer.Context,
137
137
  print("尚未授权,请先登录")
138
138
  raise typer.Exit(code=1)
139
139
  # 检查现在是处于 组织/用户 状态
140
- bayes_settings = ctx.obj
140
+ bayes_settings = BayesSettings()
141
141
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
142
142
 
143
143
  party_name = ""
@@ -192,7 +192,7 @@ def ls(ctx: typer.Context,
192
192
  print("尚未授权,请先登录")
193
193
  raise typer.Exit(code=1)
194
194
  # 检查现在是处于 组织/用户 状态
195
- bayes_settings = ctx.obj
195
+ bayes_settings = BayesSettings()
196
196
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
197
197
 
198
198
  party_name = ""
@@ -227,7 +227,7 @@ def versions(ctx: typer.Context, id: str):
227
227
  print("尚未授权,请先登录")
228
228
  raise typer.Exit(code=1)
229
229
  # 检查现在是处于 组织/用户 状态
230
- bayes_settings = ctx.obj
230
+ bayes_settings = BayesSettings()
231
231
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
232
232
 
233
233
  party_name = ""
@@ -261,7 +261,7 @@ def open(ctx: typer.Context, id: str):
261
261
  print("尚未授权,请先登录")
262
262
  raise typer.Exit(code=1)
263
263
  # 检查现在是处于 组织/用户 状态
264
- bayes_settings = ctx.obj
264
+ bayes_settings = BayesSettings()
265
265
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
266
266
 
267
267
  party_name = ""
@@ -7,7 +7,7 @@ import typer
7
7
 
8
8
  from bayes.model.file.openbayes_gear import OpenBayesGearSettings, FILE_NAME as GEAR_FILE_NAME
9
9
  from bayes.model.file.openbayes_yaml import OpenBayesYamlSettings, FILE_NAME, DEFAULT_JOB_RESOURCE, DEFAULT_JOB_RUNTIME
10
- from bayes.model.file.settings import BayesEnvConfig
10
+ from bayes.model.file.settings import BayesEnvConfig, BayesSettings
11
11
  from bayes.model.party import ModeEnum
12
12
  from bayes.usercases import auth_usecase, gear_usecase, open_usecase, resource_usecase, runtime_usecase, \
13
13
  gear_logs_usecase, gear_download_usecese, gear_run_usecase, minio_storage_usecase
@@ -41,8 +41,9 @@ def init(ctx: typer.Context,
41
41
  if not login:
42
42
  print("尚未授权,请先登录")
43
43
  raise typer.Exit(code=1)
44
- # 检查现在是处于 组织/用户 状态
45
- bayes_settings = ctx.obj
44
+
45
+ # 重新获得最新的配置
46
+ bayes_settings = BayesSettings()
46
47
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
47
48
 
48
49
  party_name = ""
@@ -100,7 +101,7 @@ def ls(ctx: typer.Context,
100
101
  print("尚未授权,请先登录")
101
102
  raise typer.Exit(code=1)
102
103
  # 检查现在是处于 组织/用户 状态
103
- bayes_settings = ctx.obj
104
+ bayes_settings = BayesSettings()
104
105
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
105
106
 
106
107
  party_name = ""
@@ -157,7 +158,7 @@ def run(
157
158
  print("尚未授权,请先登录")
158
159
  raise typer.Exit(code=1)
159
160
  # 检查现在是处于 组织/用户 状态
160
- bayes_settings = ctx.obj
161
+ bayes_settings = BayesSettings()
161
162
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
162
163
 
163
164
  party_name = ""
@@ -273,7 +274,7 @@ def status(ctx: typer.Context,
273
274
  print("尚未授权,请先登录")
274
275
  raise typer.Exit(code=1)
275
276
  # 检查现在是处于 组织/用户 状态
276
- bayes_settings = ctx.obj
277
+ bayes_settings = BayesSettings()
277
278
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
278
279
 
279
280
  party_name = ""
@@ -338,7 +339,7 @@ def restart(ctx: typer.Context,
338
339
  print("尚未授权,请先登录")
339
340
  raise typer.Exit(code=1)
340
341
  # 检查现在是处于 组织/用户 状态
341
- bayes_settings = ctx.obj
342
+ bayes_settings = BayesSettings()
342
343
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
343
344
 
344
345
  party_name = ""
@@ -416,7 +417,7 @@ def stop(ctx: typer.Context,
416
417
  print("尚未授权,请先登录")
417
418
  raise typer.Exit(code=1)
418
419
  # 检查现在是处于 组织/用户 状态
419
- bayes_settings = ctx.obj
420
+ bayes_settings = BayesSettings()
420
421
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
421
422
 
422
423
  party_name = ""
@@ -472,7 +473,7 @@ def bindings(ctx: typer.Context,
472
473
  print("尚未授权,请先登录")
473
474
  raise typer.Exit(code=1)
474
475
  # 检查现在是处于 组织/用户 状态
475
- bayes_settings = ctx.obj
476
+ bayes_settings = BayesSettings()
476
477
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
477
478
 
478
479
  party_name = ""
@@ -516,7 +517,7 @@ def download(ctx: typer.Context,
516
517
  raise typer.Exit(code=1)
517
518
 
518
519
  # 检查现在是处于 组织/用户 状态
519
- bayes_settings = ctx.obj
520
+ bayes_settings = BayesSettings()
520
521
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
521
522
 
522
523
  party_name = ""
@@ -586,7 +587,8 @@ def env(ctx: typer.Context):
586
587
  print("尚未授权,请先登录")
587
588
  raise typer.Exit(code=1)
588
589
  # 检查现在是处于 组织/用户 状态
589
- bayes_settings = ctx.obj
590
+ # 重新获得最新的配置
591
+ bayes_settings = BayesSettings()
590
592
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
591
593
 
592
594
  party_name = ""
@@ -624,7 +626,8 @@ def logs(id: str, ctx: typer.Context,
624
626
  print("尚未授权,请先登录")
625
627
  raise typer.Exit(code=1)
626
628
  # 检查现在是处于 组织/用户 状态
627
- bayes_settings = ctx.obj
629
+ # 重新获得最新的配置
630
+ bayes_settings = BayesSettings()
628
631
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
629
632
 
630
633
  party_name = ""
@@ -694,7 +697,8 @@ def open(ctx: typer.Context, id_or_name: Optional[str] = typer.Argument(None, he
694
697
  print("尚未授权,请先登录")
695
698
  raise typer.Exit(code=1)
696
699
  # 检查现在是处于 组织/用户 状态
697
- bayes_settings = ctx.obj
700
+ # 重新获得最新的配置
701
+ bayes_settings = BayesSettings()
698
702
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
699
703
 
700
704
  party_name = ""
@@ -752,8 +756,9 @@ def resource(ctx: typer.Context):
752
756
  if not login:
753
757
  print("尚未授权,请先登录")
754
758
  raise typer.Exit(code=1)
755
- # 检查现在是处于 组织/用户 状态
756
- bayes_settings = ctx.obj
759
+
760
+ # 重新获得最新的配置
761
+ bayes_settings = BayesSettings()
757
762
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
758
763
 
759
764
  party_name = ""
@@ -7,7 +7,7 @@ import typer
7
7
 
8
8
  from bayes.model.file.openbayes_gear import OpenBayesGearSettings, FILE_NAME as GEAR_FILE_NAME
9
9
  from bayes.model.file.openbayes_yaml import OpenBayesYamlSettings, FILE_NAME, DEFAULT_JOB_RESOURCE, DEFAULT_JOB_RUNTIME
10
- from bayes.model.file.settings import BayesEnvConfig
10
+ from bayes.model.file.settings import BayesEnvConfig, BayesSettings
11
11
  from bayes.model.party import ModeEnum
12
12
  from bayes.usercases import auth_usecase, gear_usecase, open_usecase, resource_usecase, runtime_usecase, \
13
13
  gear_logs_usecase, gear_download_usecese, gear_run_usecase, minio_storage_usecase
@@ -41,7 +41,7 @@ def init(ctx: typer.Context, id_or_name: str,
41
41
  print("尚未授权,请先登录")
42
42
  raise typer.Exit(code=1)
43
43
  # 检查现在是处于 组织/用户 状态
44
- bayes_settings = ctx.obj
44
+ bayes_settings = BayesSettings()
45
45
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
46
46
 
47
47
  party_name = ""
@@ -102,7 +102,7 @@ def ls(ctx: typer.Context,
102
102
  print("尚未授权,请先登录")
103
103
  raise typer.Exit(code=1)
104
104
  # 检查现在是处于 组织/用户 状态
105
- bayes_settings = ctx.obj
105
+ bayes_settings = BayesSettings()
106
106
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
107
107
 
108
108
  party_name = ""
@@ -159,7 +159,7 @@ def run(
159
159
  print("尚未授权,请先登录")
160
160
  raise typer.Exit(code=1)
161
161
  # 检查现在是处于 组织/用户 状态
162
- bayes_settings = ctx.obj
162
+ bayes_settings = BayesSettings()
163
163
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
164
164
 
165
165
  party_name = ""
@@ -277,7 +277,7 @@ def status(ctx: typer.Context,
277
277
  print("尚未授权,请先登录")
278
278
  raise typer.Exit(code=1)
279
279
  # 检查现在是处于 组织/用户 状态
280
- bayes_settings = ctx.obj
280
+ bayes_settings = BayesSettings()
281
281
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
282
282
 
283
283
  party_name = ""
@@ -342,7 +342,7 @@ def restart(ctx: typer.Context,
342
342
  print("尚未授权,请先登录")
343
343
  raise typer.Exit(code=1)
344
344
  # 检查现在是处于 组织/用户 状态
345
- bayes_settings = ctx.obj
345
+ bayes_settings = BayesSettings()
346
346
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
347
347
 
348
348
  party_name = ""
@@ -420,7 +420,7 @@ def stop(ctx: typer.Context,
420
420
  print("尚未授权,请先登录")
421
421
  raise typer.Exit(code=1)
422
422
  # 检查现在是处于 组织/用户 状态
423
- bayes_settings = ctx.obj
423
+ bayes_settings = BayesSettings()
424
424
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
425
425
 
426
426
  party_name = ""
@@ -477,7 +477,7 @@ def bindings(ctx: typer.Context,
477
477
  print("尚未授权,请先登录")
478
478
  raise typer.Exit(code=1)
479
479
  # 检查现在是处于 组织/用户 状态
480
- bayes_settings = ctx.obj
480
+ bayes_settings = BayesSettings()
481
481
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
482
482
 
483
483
  party_name = ""
@@ -521,7 +521,7 @@ def download(ctx: typer.Context,
521
521
  raise typer.Exit(code=1)
522
522
 
523
523
  # 检查现在是处于 组织/用户 状态
524
- bayes_settings = ctx.obj
524
+ bayes_settings = BayesSettings()
525
525
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
526
526
 
527
527
  party_name = ""
@@ -591,7 +591,7 @@ def env(ctx: typer.Context):
591
591
  print("尚未授权,请先登录")
592
592
  raise typer.Exit(code=1)
593
593
  # 检查现在是处于 组织/用户 状态
594
- bayes_settings = ctx.obj
594
+ bayes_settings = BayesSettings()
595
595
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
596
596
 
597
597
  party_name = ""
@@ -629,7 +629,7 @@ def logs(id: str, ctx: typer.Context,
629
629
  print("尚未授权,请先登录")
630
630
  raise typer.Exit(code=1)
631
631
  # 检查现在是处于 组织/用户 状态
632
- bayes_settings = ctx.obj
632
+ bayes_settings = BayesSettings()
633
633
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
634
634
 
635
635
  party_name = ""
@@ -699,7 +699,7 @@ def open(ctx: typer.Context, id_or_name: Optional[str] = typer.Argument(None, he
699
699
  print("尚未授权,请先登录")
700
700
  raise typer.Exit(code=1)
701
701
  # 检查现在是处于 组织/用户 状态
702
- bayes_settings = ctx.obj
702
+ bayes_settings = BayesSettings()
703
703
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
704
704
 
705
705
  party_name = ""
@@ -758,7 +758,7 @@ def resource(ctx: typer.Context):
758
758
  print("尚未授权,请先登录")
759
759
  raise typer.Exit(code=1)
760
760
  # 检查现在是处于 组织/用户 状态
761
- bayes_settings = ctx.obj
761
+ bayes_settings = BayesSettings()
762
762
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
763
763
 
764
764
  party_name = ""
@@ -2,7 +2,7 @@ from typing import Optional
2
2
 
3
3
  import typer
4
4
 
5
- from bayes.model.file.settings import BayesEnvConfig
5
+ from bayes.model.file.settings import BayesEnvConfig, BayesSettings
6
6
  from bayes.usercases import org_usecase
7
7
  from bayes.usercases import auth_usecase
8
8
 
@@ -30,7 +30,7 @@ def switch(name: str, ctx: typer.Context):
30
30
  raise typer.Exit(code=1)
31
31
 
32
32
  # 检查用户是否尝试切换回用户模式(组织名称是否与用户名相同,忽略大小写)
33
- bayes_settings = ctx.obj
33
+ bayes_settings = BayesSettings()
34
34
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
35
35
  switch_back_to_user = str.lower(name) == str.lower(default_env.username)
36
36
 
@@ -94,7 +94,7 @@ def ls(ctx: typer.Context):
94
94
  print("尚未授权,请先登录")
95
95
  raise typer.Exit(code=1)
96
96
 
97
- bayes_settings = ctx.obj
97
+ bayes_settings = BayesSettings()
98
98
  default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
99
99
 
100
100
  user_orgs_data = org_usecase.list_user_orgs(default_env.username)
@@ -118,9 +118,16 @@ class BayesSettings(BaseModel):
118
118
  def login(self, username, token):
119
119
  default_env = self.default_env
120
120
  if default_env:
121
+ # print(f"正在更新登录信息: username={username}, token={token[:10]}...")
121
122
  default_env.username = username
122
123
  default_env.token = token
123
124
  self.save_to_yaml()
125
+ # print(f"登录信息已保存到配置文件: {self.config_path}")
126
+
127
+ # 重新加载配置,确保获取最新的配置
128
+ self.load_from_yaml()
129
+ default_env = self.default_env
130
+ # print(f"登录后重新加载配置: username={default_env.username}, token={default_env.token[:10]}...")
124
131
  else:
125
132
  raise ValueError("No default environment found")
126
133
 
@@ -81,6 +81,7 @@ def login_with_token(bayes_settings, default_env, username):
81
81
 
82
82
  print(f"{result.username} 已成功登入 {default_env.name}")
83
83
  except Error as e:
84
+ print(f"登录失败: {e}")
84
85
  print("请重新输入密码或者新的令牌登陆")
85
86
  raise typer.Exit(code=1)
86
87
 
@@ -28,7 +28,8 @@ def get_default_credential_userinfo():
28
28
 
29
29
 
30
30
  def check_login():
31
- default_env: Optional[BayesEnvConfig] = BayesSettings().default_env
31
+ bayes_settings = BayesSettings()
32
+ default_env: Optional[BayesEnvConfig] = bayes_settings.default_env
32
33
  gql_client = BayesGQLClient(default_env.graphQL, None)
33
34
 
34
35
  # 检查是否已登录
@@ -39,24 +40,24 @@ def check_login():
39
40
  token = os.getenv("OPENBAYES_TOKEN")
40
41
  org = os.getenv("OPENBAYES_ORG")
41
42
  user = os.getenv("OPENBAYES_USER")
43
+
44
+ # print(f"从环境变量获取信息: token:{token}, org:{org}, user:{user}")
42
45
 
43
46
  if not token:
44
47
  return False
45
48
 
46
49
  try:
47
50
  login_model = user_client.login_with_token(gql_client, token)
48
- # 登陆成功,获得用户信息,去修改文件
49
- BayesSettings().login(login_model.username, login_model.token)
50
-
51
+ bayes_settings.login(login_model.username, token)
51
52
  # 更新 orgName
52
53
  if org and user:
53
- if org == user:
54
- default_env.orgName = ""
55
- else:
56
- default_env.orgName = org
54
+ if org != user:
55
+ bayes_settings.switch_org(org)
56
+
57
57
  return True
58
58
  except Error as e:
59
- print("登陆失败,请重新使用密码或者新的令牌登录")
59
+ print(f"登陆失败: {e}")
60
+ print("请重新使用密码或者新的令牌登录")
60
61
  raise typer.Exit(code=1)
61
62
 
62
63
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openbayes-cli"
3
- version = "0.7.0"
3
+ version = "0.8.0"
4
4
  description = "A Python CLI for OpenBayes"
5
5
  authors = ["OpenBayes <dev@openbayes.com>"]
6
6
  readme = "README.md"
File without changes