accli 0.7.9__tar.gz → 0.7.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accli
3
- Version: 0.7.9
3
+ Version: 0.7.11
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -12,6 +12,8 @@ from typing import List, Tuple
12
12
 
13
13
  from accli.common import todict
14
14
 
15
+ ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
16
+
15
17
  class AccAPIError(Exception):
16
18
  pass
17
19
 
@@ -38,7 +40,7 @@ class AcceleratorJobProjectService:
38
40
  self,
39
41
  user_token,
40
42
  server_url='http://accelerator-api.iiasa.ac.at',
41
- verify_cert=True
43
+ verify_cert=(not ACCLI_DEBUG)
42
44
  ):
43
45
 
44
46
  self.user_token = user_token
@@ -739,7 +741,7 @@ class Fs:
739
741
  accelerator_job_service = AcceleratorJobProjectService(
740
742
  user_token,
741
743
  server_url=server_url,
742
- verify_cert=True
744
+ verify_cert=(not ACCLI_DEBUG)
743
745
  )
744
746
 
745
747
  accelerator_job_service.add_filestream_as_job_output(
@@ -763,7 +765,7 @@ class Fs:
763
765
  accelerator_job_service = AcceleratorJobProjectService(
764
766
  user_token,
765
767
  server_url=server_url,
766
- verify_cert=True
768
+ verify_cert=(not ACCLI_DEBUG)
767
769
  )
768
770
 
769
771
  return accelerator_job_service.get_file_url_from_repo(
@@ -805,7 +807,7 @@ class Fs:
805
807
  accelerator_job_service = AcceleratorJobProjectService(
806
808
  user_token,
807
809
  server_url=server_url,
808
- verify_cert=True
810
+ verify_cert=(not ACCLI_DEBUG)
809
811
  )
810
812
 
811
813
  return accelerator_job_service.enumerate_files_by_prefix(
@@ -5,6 +5,7 @@ import hashlib
5
5
  import shutil
6
6
  import tempfile
7
7
  import requests
8
+ from functools import lru_cache
8
9
  from typing import Optional, List, Dict
9
10
  from pydantic.v1 import BaseModel, root_validator
10
11
  from accli.AcceleratorTerminalCliProjectService import AcceleratorTerminalCliProjectService
@@ -14,6 +15,8 @@ from accli.token import (
14
15
  get_project_slug
15
16
  )
16
17
 
18
+ ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
19
+
17
20
  FOLDER_JOB_REPO_URL = 'https://github.com/IIASA-Accelerator/wkube-job.git'
18
21
 
19
22
 
@@ -60,6 +63,7 @@ def copy_tree(src, dst):
60
63
  else:
61
64
  shutil.copy2(src_path, dst_path)
62
65
 
66
+ @lru_cache(maxsize=None)
63
67
  def push_folder_job(dir):
64
68
 
65
69
  access_token = get_token()
@@ -71,7 +75,7 @@ def push_folder_job(dir):
71
75
  term_cli_project_service = AcceleratorTerminalCliProjectService(
72
76
  user_token=access_token,
73
77
  server_url=server_url,
74
- verify_cert=False
78
+ verify_cert=(not ACCLI_DEBUG)
75
79
  )
76
80
 
77
81
  repo_dir = tempfile.mkdtemp()
@@ -204,7 +208,9 @@ class WKubeTaskKwargs(BaseModel):
204
208
  job_folder = values.get('job_folder', './')
205
209
 
206
210
  if not (values.get('repo_url') and values.get('repo_branch')):
207
- remote_url, branch_name = push_folder_job(job_folder)
211
+ remote_url, branch_name = push_folder_job(
212
+ os.path.abspath(job_folder)
213
+ )
208
214
  values['repo_url'] = remote_url
209
215
  values['repo_branch'] = branch_name
210
216
  else:
@@ -9,6 +9,8 @@ from rich.progress import Progress
9
9
 
10
10
  from accli.common import todict
11
11
 
12
+ ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
13
+
12
14
  class AccAPIError(Exception):
13
15
 
14
16
  def __init__(self, message, response, status_code):
@@ -33,7 +35,7 @@ class AcceleratorTerminalCliProjectService:
33
35
  self,
34
36
  user_token,
35
37
  server_url,
36
- verify_cert=True
38
+ verify_cert=(not ACCLI_DEBUG)
37
39
  ):
38
40
 
39
41
  self.user_token = user_token
@@ -1,3 +1,3 @@
1
1
  # Please strictly put double quote to use this info for git tag
2
2
  # Read developer guide for git tag command with regex
3
- VERSION = "v0.7.9"
3
+ VERSION = "v0.7.11"
@@ -20,6 +20,8 @@ from rich.progress import Progress, SpinnerColumn, TextColumn, ProgressColumn, B
20
20
 
21
21
  warnings.filterwarnings('ignore')
22
22
 
23
+ ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
24
+
23
25
  app = typer.Typer(
24
26
  add_completion=False,
25
27
  pretty_exceptions_show_locals=False,
@@ -61,7 +63,8 @@ def login(
61
63
 
62
64
  token_response = requests.post(
63
65
  f"{server}/v1/oauth/device/token/",
64
- json={"device_authorization_code": device_authorization_code}
66
+ json={"device_authorization_code": device_authorization_code},
67
+ verify=(not ACCLI_DEBUG)
65
68
  )
66
69
 
67
70
  print("")
@@ -83,7 +86,7 @@ def upload_file(project_slug, accelerator_filename, local_filepath, progress, ta
83
86
  term_cli_project_service = AcceleratorTerminalCliProjectService(
84
87
  user_token=access_token,
85
88
  server_url=server_url,
86
- verify_cert=False
89
+ verify_cert=(not ACCLI_DEBUG)
87
90
  )
88
91
 
89
92
  stat = term_cli_project_service.get_file_stat(project_slug, f"{folder_name}/{accelerator_filename}")
@@ -161,7 +164,7 @@ def validate(
161
164
  term_cli_project_service = AcceleratorTerminalCliProjectService(
162
165
  user_token="",
163
166
  server_url=server,
164
- verify_cert=False
167
+ verify_cert=(not ACCLI_DEBUG)
165
168
  )
166
169
 
167
170
  validate = CsvRegionalTimeseriesValidator(
@@ -187,7 +190,7 @@ def dispatch(
187
190
  term_cli_project_service = AcceleratorTerminalCliProjectService(
188
191
  user_token=access_token,
189
192
  server_url=server_url,
190
- verify_cert=False
193
+ verify_cert=(not ACCLI_DEBUG)
191
194
  )
192
195
 
193
196
  base_dir = os.getcwd()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accli
3
- Version: 0.7.9
3
+ Version: 0.7.11
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
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