cloudpss 4.0.9__py3-none-any.whl → 4.0.10__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.
cloudpss/runner/runner.py CHANGED
@@ -117,6 +117,49 @@ class Runner(Generic[T]):
117
117
  graphql_request(query, variables)
118
118
 
119
119
 
120
+ @staticmethod
121
+ def __createJobVariables(job, config, revisionHash, rid, policy, **kwargs):
122
+ # 处理policy字段
123
+ if policy is None:
124
+ policy = {}
125
+ if policy.get("tres", None) is None:
126
+ policy["tres"] = {}
127
+ policy["queue"] = job["args"].get("@queue", 1)
128
+ policy["priority"] = job["args"].get("@priority", 0)
129
+ tres = {"cpu": 1, "ecpu": 0, "mem": 0}
130
+ tresStr = job["args"].get("@tres", "")
131
+ for t in re.split("\s+", tresStr):
132
+ if t == "":
133
+ continue
134
+ k, v = t.split("=")
135
+ tres[k] = float(v) # type: ignore
136
+ policy["tres"] = tres
137
+ function = job["rid"].replace("job-definition/cloudpss/", "function/CloudPSS/")
138
+ implement = kwargs.get("implement", None)
139
+ debug = job["args"].get("@debug", None )
140
+ debugargs={}
141
+ if debug is not None:
142
+ t= [ i.split('=') for i in re.split(r'\s+',debug) if i.find('=')>0]
143
+ for i in t:
144
+ debugargs[i[0]]=i[1]
145
+ variables = {
146
+ "input": {
147
+ "args": {
148
+ **job["args"],
149
+ "_ModelRevision": revisionHash,
150
+ "_ModelArgs": config["args"],
151
+ "implement":implement
152
+ },
153
+ "context": [
154
+ function,
155
+ rid,
156
+ f"model/@sdk/{str(int(time.time() * random.random()))}",
157
+ ],
158
+ "policy": policy,
159
+ "debug":debugargs
160
+ }
161
+ }
162
+ return variables
120
163
  @staticmethod
121
164
  def create(revisionHash,
122
165
  job,
@@ -139,42 +182,9 @@ class Runner(Generic[T]):
139
182
  >>> runner = Runner.runRevision(revision,job,config,'')
140
183
  '''
141
184
 
142
- #处理policy字段
143
- if policy is None:
144
- policy = {}
145
- if policy.get('tres', None) is None:
146
- policy['tres'] = {}
147
- policy['queue'] = job['args'].get('@queue', 1)
148
- policy['priority'] = job['args'].get('@priority', 0)
149
- tres = {'cpu': 1, 'ecpu': 0, 'mem': 0}
150
- tresStr = job['args'].get('@tres', '')
151
- for t in re.split('\s+', tresStr):
152
- if t == '':
153
- continue
154
- k, v = t.split('=')
155
- tres[k] = float(v) #type: ignore
156
- policy['tres'] = tres
157
185
 
158
186
  query = '''mutation($input:CreateJobInput!){job:createJob(input:$input){id input output status position}}'''
159
- function = job['rid'].replace('job-definition/cloudpss/',
160
- 'function/CloudPSS/')
161
- variables = {
162
- 'input': {
163
- "args":
164
- {
165
- **job['args'],
166
- '_ModelRevision' : revisionHash,
167
- '_ModelArgs' : config['args']
168
- },
169
- "context": [
170
- function,
171
- f"model/@sdk/{str(int(time.time() * random.random()))}",
172
- rid
173
- ],
174
- "policy":
175
- policy,
176
- }
177
- }
187
+ variables = Runner.__createJobVariables(job, config, revisionHash, rid,policy)
178
188
  r = graphql_request(query, variables)
179
189
  if 'errors' in r:
180
190
  raise Exception(r['errors'])
cloudpss/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '4.0.9'
1
+ __version__ = '4.0.10'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudpss
3
- Version: 4.0.9
3
+ Version: 4.0.10
4
4
  Summary: cloudpss sdk
5
5
  Home-page: https://www.cloudpss.net
6
6
  Author: cloudpss
@@ -1,6 +1,6 @@
1
1
  cloudpss/__init__.py,sha256=Ov8K45KxSsPalPErvTRUb2GvPdJ3myucFqx7s37_YZo,777
2
2
  cloudpss/verify.py,sha256=KF4Gd59DGvCyIEkRD7rNnekWw22XxJpi3DW6keb6j4c,1498
3
- cloudpss/version.py,sha256=2oNKSIKlnfdd0ZbA1rgLav4jBtGlvL2-YyRkzkXQ-4Y,21
3
+ cloudpss/version.py,sha256=Ege2brqXrcuXLm4WrkZEWhSq2i2sm8UnLiOherRikZM,22
4
4
  cloudpss/asyncio/__init__.py,sha256=CJGopQl_vz3z3fJsK7NjMX5uzkzfrJrbqKVhyYqlYWc,198
5
5
  cloudpss/asyncio/job/__init__.py,sha256=3UIFZYjJTzuckM61o8kim1c3PWt2SSHTL72jrGu5IzI,51
6
6
  cloudpss/asyncio/job/job.py,sha256=ExA-8JVOWWW5neVvNazPk4i3Z-q8xqYBL4qXU1m3rgM,3891
@@ -53,7 +53,7 @@ cloudpss/runner/MessageStreamReceiver.py,sha256=_G_7LIFdm7EtOf046nT-V3HNmygAm2oo
53
53
  cloudpss/runner/__init__.py,sha256=aZ00V2AzQNBbER0xi6pqFFyiLFM-6r1fxvzdxxUJA_4,241
54
54
  cloudpss/runner/receiver.py,sha256=d8vOtBJ_Iqo3syJXgFFxwii1MXF7CyHRoXy6eT81Zq4,4096
55
55
  cloudpss/runner/result.py,sha256=GFpd7848gsLRuzhVcWbCwmAjR84Lhik_3pNCjOV8VOY,13291
56
- cloudpss/runner/runner.py,sha256=207PVoD3mjPiqWy6Qt3L5EU0woO7jmv_xj_bRuE9tDU,7299
56
+ cloudpss/runner/runner.py,sha256=dyh_Sm38F-W8HatjRuVFEqd5Jla-d_GasRZ978zdMvw,7808
57
57
  cloudpss/runner/storage.py,sha256=zFET_zwPIOF2Cnh9sgFiS0HFxV1OmVsU34bGUQ6PpkA,4162
58
58
  cloudpss/runner/transform.py,sha256=krOgTZiJSJAb5QSwerAqlbC4Ma0PKi__0WOZlAxw4O8,11613
59
59
  cloudpss/utils/IO.py,sha256=Uh1NOlBn15Jl5_aWS2QRO2-QsKlFT9o8DPtP8-8Z2PA,5314
@@ -63,7 +63,7 @@ cloudpss/utils/graphqlUtil.py,sha256=swl6XT1UmUQHdHjMWw3M0i8meEmVKNQvX0SHsbgg8TU
63
63
  cloudpss/utils/httprequests.py,sha256=-RYi1Dc4QDqqupuw0x-lq74dFvCqPrZfCJKgrdolEpk,1643
64
64
  cloudpss/utils/matlab.py,sha256=SLwVt790BjklJK2XNELt9R2n_1ej9Y8QsTIdFkKXLWE,795
65
65
  cloudpss/utils/yamlLoader.py,sha256=KRlRkHFltOjqxa_sesdBLf1W5J7XTgvubszsSw-XR0U,2885
66
- cloudpss-4.0.9.dist-info/METADATA,sha256=QFCkrdrZ42g811aO48rq2YLeqgwLjSQKyxgTORyVIe4,2368
67
- cloudpss-4.0.9.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
68
- cloudpss-4.0.9.dist-info/top_level.txt,sha256=wS9qPU4-aWM9ouzMOx34Nlq-GkdQKpr9vBskwut1BD8,9
69
- cloudpss-4.0.9.dist-info/RECORD,,
66
+ cloudpss-4.0.10.dist-info/METADATA,sha256=CYk2niKEQIRO8GtB6XmKwrlPFjStHDKabJC5N1Gd-aY,2369
67
+ cloudpss-4.0.10.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
68
+ cloudpss-4.0.10.dist-info/top_level.txt,sha256=wS9qPU4-aWM9ouzMOx34Nlq-GkdQKpr9vBskwut1BD8,9
69
+ cloudpss-4.0.10.dist-info/RECORD,,