jolt 0.9.350__py3-none-any.whl → 0.9.353__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.

Potentially problematic release.


This version of jolt might be problematic. Click here for more details.

jolt/graph.py CHANGED
@@ -445,7 +445,7 @@ class TaskProxy(object):
445
445
  # Exclude transitive alias and resources dependencies.
446
446
  # Workspace resources are included as they may be required by its dependencies.
447
447
  self.children = list(
448
- filter(lambda n: (dag.are_neighbors(self, n) or n.is_workspace_resource()) or (not n.is_alias() and not n.is_resource()),
448
+ filter(lambda n: dag.are_neighbors(self, n) or (not n.is_alias() and not n.is_resource()),
449
449
  utils.unique_list(self.children)))
450
450
 
451
451
  # Prepare workspace resources for this task so that influence can be calculated
@@ -733,8 +733,7 @@ class TaskProxy(object):
733
733
  log_prefix = False
734
734
 
735
735
  # Collect list of resource dependencies
736
- resource_deps = [child for child in self.children if child.is_resource() and not child.is_workspace_resource()]
737
- resource_deps_ws = [child for child in self.children if child.is_workspace_resource()]
736
+ resource_deps = [child for child in self.children if child.is_resource()]
738
737
 
739
738
  if self.options.worker:
740
739
  # Exclude local resources when running as worker. They are already acquired by the client.
@@ -749,7 +748,7 @@ class TaskProxy(object):
749
748
  acquired = []
750
749
  try:
751
750
  # Acquire resource dependencies in reverse order.
752
- for resource in reversed(resource_deps + resource_deps_ws):
751
+ for resource in reversed(resource_deps):
753
752
  with resource.lock_artifacts(discard=False) if not resource.is_workspace_resource() else nullcontext():
754
753
  resource.deps = self.cache.get_context(resource)
755
754
  exitstack.enter_context(resource.deps)
jolt/tasks.py CHANGED
@@ -20,6 +20,7 @@ import traceback
20
20
  from jolt import filesystem as fs
21
21
  from jolt import log
22
22
  from jolt import utils
23
+ from jolt.cache import ArtifactAttributeSetProvider
23
24
  from jolt.error import raise_error_if, raise_task_error, raise_task_error_if
24
25
  from jolt.error import raise_unreported_task_error_if
25
26
  from jolt.error import JoltError, JoltCommandError, LoggedJoltError
@@ -135,7 +136,7 @@ class Parameter(object):
135
136
  self.name = name
136
137
 
137
138
  def __init__(self, default=None, values=None, required=True,
138
- const=False, influence=True, help=None):
139
+ const=False, influence=True, help=None, valuesfn=None):
139
140
  """
140
141
  Creates a new parameter.
141
142
 
@@ -143,6 +144,10 @@ class Parameter(object):
143
144
  default (str, optional): An optional default value.
144
145
  values (list, optional): A list of accepted values. An
145
146
  assertion is raised if an unlisted value is assigned to the parameter.
147
+ valuesfn (func, optional); A function that validates the assigned value.
148
+ If both values and valuesfn are specified, the values list is validated
149
+ first. The function is passed the assigned value and should return.
150
+ boolean value. If the function returns False, a ParameterValueError is raised.
146
151
  required (boolean, optional): If required, the parameter must be assigned
147
152
  a value before the task can be executed. The default is ``True``.
148
153
  const (boolean, optional): If const is True, the parameter is immutable
@@ -164,6 +169,7 @@ class Parameter(object):
164
169
  self._default = default
165
170
  self._value = default
166
171
  self._accepted_values = values
172
+ self._accepted_values_fn = valuesfn
167
173
  self._required = required
168
174
  self._const = const
169
175
  self._influence = influence
@@ -199,6 +205,8 @@ class Parameter(object):
199
205
  def _validate(self, value, what=None):
200
206
  if self._accepted_values is not None and value not in self._accepted_values:
201
207
  raise ParameterValueError(self, value, what=what)
208
+ if self._accepted_values_fn is not None and not self._accepted_values_fn(value):
209
+ raise ParameterValueError(self, value, what=what)
202
210
 
203
211
  def get_default(self):
204
212
  """ Get the default value of the parameter.
@@ -436,7 +444,7 @@ class IntParameter(Parameter):
436
444
  """
437
445
 
438
446
  def __init__(self, default=None, min=None, max=None, values=None, required=True, const=False,
439
- influence=True, help=None):
447
+ influence=True, help=None, valuesfn=None):
440
448
  """
441
449
  Creates a new parameter.
442
450
 
@@ -484,7 +492,8 @@ class IntParameter(Parameter):
484
492
  required=required,
485
493
  const=const,
486
494
  influence=influence,
487
- help=help)
495
+ help=help,
496
+ valuesfn=valuesfn)
488
497
 
489
498
  def _validate(self, value, what=None):
490
499
  if self._min is not None and value < self._min:
@@ -688,6 +697,10 @@ class ListParameter(Parameter):
688
697
  for item in value:
689
698
  if item not in self._accepted_values:
690
699
  raise ParameterValueError(self, item, what=what)
700
+ if self._accepted_values_fn is not None:
701
+ for item in value:
702
+ if not self._accepted_values_fn(item):
703
+ raise ParameterValueError(self, item, what=what)
691
704
 
692
705
  def get_value(self):
693
706
  return "+".join(self._value)
@@ -3394,3 +3407,45 @@ class Test(Task):
3394
3407
  "{} tests out of {} were successful".format(
3395
3408
  len(self.testresult.successes),
3396
3409
  self.testresult.testsRun))
3410
+
3411
+
3412
+ @ArtifactAttributeSetProvider.Register
3413
+ class WorkspaceResourceAttributeSetProvider(ArtifactAttributeSetProvider):
3414
+ def create(self, artifact):
3415
+ pass
3416
+
3417
+ def parse(self, artifact, content):
3418
+ pass
3419
+
3420
+ def format(self, artifact, content):
3421
+ pass
3422
+
3423
+ def apply(self, task, artifact):
3424
+ resource = artifact.task
3425
+ node = artifact.get_node()
3426
+ if not node.is_workspace_resource():
3427
+ return
3428
+
3429
+ resource.deps = node.cache.get_context(node)
3430
+ resource.deps.__enter__()
3431
+
3432
+ try:
3433
+ resource.acquire(artifact=artifact, deps=resource.deps, tools=resource.tools, owner=task)
3434
+ except (KeyboardInterrupt, Exception) as e:
3435
+ if resource.release_on_error:
3436
+ with utils.ignore_exception():
3437
+ self.unapply(task, artifact)
3438
+ raise e
3439
+
3440
+ def unapply(self, task, artifact):
3441
+ resource = artifact.task
3442
+ node = artifact.get_node()
3443
+ if not node.is_workspace_resource():
3444
+ return
3445
+
3446
+ try:
3447
+ resource.release(artifact=artifact, deps=resource.deps, tools=resource.tools, owner=task)
3448
+ except Exception as e:
3449
+ raise e
3450
+
3451
+ resource.deps.__exit__(None, None, None)
jolt/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.9.350"
1
+ __version__ = "0.9.353"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jolt
3
- Version: 0.9.350
3
+ Version: 0.9.353
4
4
  Summary: A task executor
5
5
  Home-page: https://github.com/srand/jolt
6
6
  Author: Robert Andersson
@@ -10,7 +10,7 @@ jolt/config.py,sha256=2S8_bdcHaNzwDfkCkHNjFaWn9pykStA4rUa7pz3m5Sg,10367
10
10
  jolt/error.py,sha256=wbYU_ip3zGHlhmjQWjEeLlmLdTpiqIeFM5zJndVQdj4,2399
11
11
  jolt/expires.py,sha256=GDagfgJOlX_z2LLIFhKHBaXI96jo1S3ca2OGWQi1oj4,2330
12
12
  jolt/filesystem.py,sha256=BytxYk6Xq0peuRB9gUZ7EDsvbgirfp4EcjPANNDIstQ,5916
13
- jolt/graph.py,sha256=fpnpxi7DwTBk9Mh88iskOkptjpdjU1WFEsFmXnockXo,45698
13
+ jolt/graph.py,sha256=Gnp47hJyUqRwHh1ISvHmb7ZeMVDOaCmQgF5_l2rboQI,45515
14
14
  jolt/hooks.py,sha256=jcCaNwlyFrWkXrO6MiO_roDQVohefbablfXnuQ3dmmM,11029
15
15
  jolt/influence.py,sha256=c5Vdizk9kK-8O7cSU9LAHhh8xkvchudstBn7HLIr9hg,16937
16
16
  jolt/inspection.py,sha256=QkOCXAbjJBdw1SMsb6xH_3GHXV5BcdzaGD7HrGmOJss,3931
@@ -19,11 +19,11 @@ jolt/log.py,sha256=cqEfX__AWSA4onueTTdoL4HnovEtzT4yoRoyKQk2MH8,14592
19
19
  jolt/manifest.py,sha256=T2-JPiXmYU4DNYTKLnDi1ywCufLYaIIAdoGWYrTL6V0,8529
20
20
  jolt/options.py,sha256=P1uuxq7oJzlN4NTrZvj2NRH2CaVQObKy2DoETjwrBeA,434
21
21
  jolt/scheduler.py,sha256=HRC8dAl9asI1exn7AUqBO0hbYzBlaSaGHgNqDlpQ72Q,21470
22
- jolt/tasks.py,sha256=RYgkG_VB1CxJ_KPbNwPa-EWmqkES7uyvhqyFGtHDtQw,112809
22
+ jolt/tasks.py,sha256=D3X1XHnSuDDWAEis-Y6ULGIXTlLNCZTikLHZkbWEoII,114916
23
23
  jolt/timer.py,sha256=PE-7vmsqZpF73e_cKSsrhd36-A7fJ9_XGYI_oBWJn5w,644
24
24
  jolt/tools.py,sha256=_ijnN47sDFaEDhPMPIkLKcqGOewk2MLzvvyp3kuoask,79867
25
25
  jolt/utils.py,sha256=6TphNzqr2AAQ55bGDD36YoJSi8qQM3FRkrY1iIkhtNA,18771
26
- jolt/version.py,sha256=lrUnx27u4yml1xuI2hCpgfAIoqn2zRxc_QY5KPnVTA0,24
26
+ jolt/version.py,sha256=CFAUtAbKnKw-U5d_p4brOxcWA0qibAp7qq3XaPeIhtI,24
27
27
  jolt/version_utils.py,sha256=tNCGT6ZmSGFHW1aw2Hx1l19m-RR1UnTN6xJV1I54KRw,3900
28
28
  jolt/xmldom.py,sha256=SbygiDUMYczzWGxXa60ZguWS6Nztg8gDAirdbtjT15I,5982
29
29
  jolt/bin/fstree-darwin-x86_64,sha256=i4Ppbdr7CxsEhJzWpy3GMB5Gn5ikmskh41MyUwQS3-o,29549000
@@ -86,8 +86,8 @@ jolt/templates/cxxexecutable.cmake.template,sha256=f0dg1VOFlamlF8fuHFTki5dsJ2ssS
86
86
  jolt/templates/cxxlibrary.cmake.template,sha256=GMEG2G3QoY3E5fsNer52zOqgM221-abeCkV__mVbZ94,1750
87
87
  jolt/templates/export.sh.template,sha256=PKkflGXFbq70EIsowqcnLvzbnEDnqh_WgC4E_JNT0VE,1937
88
88
  jolt/templates/timeline.html.template,sha256=xdqvFBmhE8XRQaWgcIFBVbd__9HdRq6O-U0o276PyjU,1222
89
- jolt-0.9.350.dist-info/METADATA,sha256=qxGNCJtXk0C9KGspuOEPpTeCYtO_hx1wXaGjGcOtcHA,5557
90
- jolt-0.9.350.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
91
- jolt-0.9.350.dist-info/entry_points.txt,sha256=VZ-QH38Z9HJc1O57wfzr-soHn6exwc3N0TSrRum4tYg,44
92
- jolt-0.9.350.dist-info/top_level.txt,sha256=HwzVmAwUrvCUUHRi3zUfcpdKTsdNrZmPCvsrsWSFyqE,5
93
- jolt-0.9.350.dist-info/RECORD,,
89
+ jolt-0.9.353.dist-info/METADATA,sha256=Qp9yP9-opcBieo4a1p9fsxEsYse9KQWLE1xh_XV0Tcc,5557
90
+ jolt-0.9.353.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
91
+ jolt-0.9.353.dist-info/entry_points.txt,sha256=VZ-QH38Z9HJc1O57wfzr-soHn6exwc3N0TSrRum4tYg,44
92
+ jolt-0.9.353.dist-info/top_level.txt,sha256=HwzVmAwUrvCUUHRi3zUfcpdKTsdNrZmPCvsrsWSFyqE,5
93
+ jolt-0.9.353.dist-info/RECORD,,
File without changes