jolt 0.9.449__py3-none-any.whl → 0.9.452__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.
jolt/config.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from configparser import ConfigParser, NoOptionError, NoSectionError
2
+ from datetime import timedelta
2
3
  from urllib.parse import urlparse
3
4
  import os
4
5
  import re
@@ -152,6 +153,18 @@ def get(section, key, default=None, expand=True, alias=None):
152
153
  return utils.expand(val) if expand and val is not None else val
153
154
 
154
155
 
156
+ def getduration(section, key, default=None, alias=None):
157
+ value = get(section, key, default=None, alias=alias)
158
+ if value is None:
159
+ if type(default) is timedelta:
160
+ return default
161
+ elif default is not None:
162
+ value = str(default)
163
+ else:
164
+ return None
165
+ return utils.parse_duration(value)
166
+
167
+
155
168
  def getint(section, key, default=None, alias=None):
156
169
  value = get(section, key, default=default, alias=alias)
157
170
  if value is not None:
jolt/plugins/cache.py CHANGED
@@ -20,7 +20,7 @@ class Cache(cache.StorageProvider):
20
20
  def __init__(self, cache):
21
21
  super().__init__()
22
22
  self._cache = cache
23
- self._uri = config.get(NAME, "uri", "http://cache")
23
+ self._uri = config.get(NAME, "http_uri", "http://cache")
24
24
  self._uri = self._uri.rstrip("/")
25
25
  raise_error_if(not self._uri, "Cache Service URI not configured")
26
26
  self._file_uri = self._uri + "/files"
jolt/plugins/scheduler.py CHANGED
@@ -33,6 +33,18 @@ NAME = "scheduler"
33
33
  TYPE = "Remote execution"
34
34
 
35
35
 
36
+ grpc_keepalive_opts = []
37
+ grpc_keepalive_time = config.getduration(NAME, "grpc_keepalive_time")
38
+ grpc_keepalive_timeout = config.getduration(NAME, "grpc_keepalive_timeout")
39
+ grpc_keepalive_without_calls = config.getboolean(NAME, "grpc_keepalive_without_calls", False)
40
+ if grpc_keepalive_time is not None:
41
+ grpc_keepalive_opts.append(("grpc.keepalive_time_ms", int(grpc_keepalive_time.total_seconds() * 1000)))
42
+ if grpc_keepalive_timeout is not None:
43
+ grpc_keepalive_opts.append(("grpc.keepalive_timeout_ms", int(grpc_keepalive_timeout.total_seconds() * 1000)))
44
+ if grpc_keepalive_without_calls:
45
+ grpc_keepalive_opts.append(("grpc.keepalive_permit_without_calls", 1))
46
+
47
+
36
48
  def locked(func):
37
49
  """ Decorator to lock a method. """
38
50
  def _f(self, *args, **kwargs):
@@ -394,7 +406,7 @@ class RemoteSession(object):
394
406
  self.factory = factory
395
407
 
396
408
  # Address of the scheduler.
397
- self.address = config.geturi(NAME, "uri", "tcp://scheduler.:9090")
409
+ self.address = config.geturi(NAME, "grpc_uri", "tcp://scheduler.:9090")
398
410
  raise_error_if(self.address.scheme not in ["tcp"], "Invalid scheme in scheduler URI config: {}", self.address.scheme)
399
411
  raise_error_if(not self.address.netloc, "Invalid network address in scheduler URI config: {}", self.address.netloc)
400
412
 
@@ -404,6 +416,7 @@ class RemoteSession(object):
404
416
  # GRPC channel.
405
417
  self.channel = grpc.insecure_channel(
406
418
  target=self.address.netloc,
419
+ options=grpc_keepalive_opts,
407
420
  )
408
421
 
409
422
  # GRPC stub for the scheduler service.
@@ -559,11 +572,11 @@ log.verbose("[Remote] Loaded")
559
572
  @click.argument("request", required=True)
560
573
  @click.pass_context
561
574
  def executor(ctx, worker, build, request):
562
- address = config.geturi(NAME, "uri", "tcp://scheduler.:9090")
575
+ address = config.geturi(NAME, "grpc_uri", "tcp://scheduler.:9090")
563
576
  raise_error_if(address.scheme not in ["tcp"], "Invalid scheme in scheduler URI config: {}", address.scheme)
564
577
  raise_error_if(not address.netloc, "Invalid network address in scheduler URI config: {}", address.netloc)
565
578
 
566
- channel = grpc.insecure_channel(address.netloc)
579
+ channel = grpc.insecure_channel(address.netloc, options=grpc_keepalive_opts)
567
580
  log.verbose("Waiting for GRPC channel to connect")
568
581
  grpc.channel_ready_future(channel).result()
569
582
  log.verbose("GRPC channel established: {}", address.netloc)
@@ -159,7 +159,7 @@ def publish_artifact():
159
159
  executor.run(env)
160
160
  jolt_url = acache.location(task.artifacts[0])
161
161
  raise_error_if(not jolt_url, "Failed to deploy jolt to a remote cache")
162
- cacheUrl = config.get("http", "uri", config.get("cache", "uri", "") + "/files")
162
+ cacheUrl = config.get("http", "uri", config.get("cache", "http_uri", "") + "/files")
163
163
  substituteUrl = config.get("selfdeploy", "baseUri")
164
164
  if cacheUrl and substituteUrl:
165
165
  return task.identity, jolt_url.replace(cacheUrl, substituteUrl)
jolt/utils.py CHANGED
@@ -1,3 +1,4 @@
1
+ from datetime import timedelta
1
2
  import blake3
2
3
  import contextlib
3
4
  import ctypes
@@ -725,3 +726,40 @@ def platform_os_arch():
725
726
  f"Unsupported platform: {uname.system} {uname.machine}"
726
727
  ) from None
727
728
  return system, architecture
729
+
730
+
731
+ def parse_duration(value: str) -> timedelta:
732
+ """ Parses a duration string into a timedelta object.
733
+
734
+ Supported formats are:
735
+ - Nms (milliseconds)
736
+ - Ns (seconds)
737
+ - Nm (minutes)
738
+ - Nh (hours)
739
+ - Nd (days)
740
+ - Nw (weeks)
741
+
742
+ Where N is an integer.
743
+ """
744
+ pattern = r"^(?P<value>\d+)(?P<unit>s|m|h|d|w)$"
745
+ match = re.match(pattern, value)
746
+ if not match:
747
+ raise ValueError(f"Invalid duration format: {value}")
748
+
749
+ value = int(match.group("value"))
750
+ unit = match.group("unit")
751
+
752
+ if unit == "ms":
753
+ return timedelta(milliseconds=value)
754
+ elif unit == "s":
755
+ return timedelta(seconds=value)
756
+ elif unit == "m":
757
+ return timedelta(minutes=value)
758
+ elif unit == "h":
759
+ return timedelta(hours=value)
760
+ elif unit == "d":
761
+ return timedelta(days=value)
762
+ elif unit == "w":
763
+ return timedelta(weeks=value)
764
+
765
+ raise ValueError(f"Unsupported duration unit: {unit}")
jolt/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.9.449"
1
+ __version__ = "0.9.452"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jolt
3
- Version: 0.9.449
3
+ Version: 0.9.452
4
4
  Summary: A task executor
5
5
  Home-page: https://github.com/srand/jolt
6
6
  Author: Robert Andersson
@@ -6,7 +6,7 @@ jolt/cli.py,sha256=9swmWPDaGpJom0aYtaoPBppKGc9EcGWC7zkrsd1aC-E,43090
6
6
  jolt/colors.py,sha256=P6vhaILGoOn8odEwQ6-z871YQoTe3HRLgS6clavwVHs,737
7
7
  jolt/common_pb2.py,sha256=Oe9cyZ4qNyS2aTunjiO7tAO3XVw8XkZ1M7TaTmss3bs,6335
8
8
  jolt/common_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
9
- jolt/config.py,sha256=khzo4BNfNZoClTHVJGTWLhLBLAWH7lWj5cIdxr73Phg,9981
9
+ jolt/config.py,sha256=flnB3Ux7hUUY6jtIcKjP2tXJfVeU8t2qyBK3Dnke574,10360
10
10
  jolt/error.py,sha256=wbYU_ip3zGHlhmjQWjEeLlmLdTpiqIeFM5zJndVQdj4,2399
11
11
  jolt/expires.py,sha256=GDagfgJOlX_z2LLIFhKHBaXI96jo1S3ca2OGWQi1oj4,2330
12
12
  jolt/filesystem.py,sha256=_e4tEvtRESUaaPAhkA1dwVXjllAkJnOVoj2bfA7ur-Y,5941
@@ -22,8 +22,8 @@ jolt/scheduler.py,sha256=2xehPvoJDLdv211UdP2cqqQs2M2L5Ozw2_GuE556Tjg,32513
22
22
  jolt/tasks.py,sha256=aB_W7jAXQ6tSFRTKjYtRqUWP4yHG_DW63VW25e_UjAk,118823
23
23
  jolt/timer.py,sha256=PE-7vmsqZpF73e_cKSsrhd36-A7fJ9_XGYI_oBWJn5w,644
24
24
  jolt/tools.py,sha256=C8cOmnxQ08NoYxLdwA8vfDTPnOdlJ6MoXFpwT2NRI24,82508
25
- jolt/utils.py,sha256=XkAIdiEzv8yWJnyx2H6_0L7Wy7HJB-6BtaSObmq1uOQ,19710
26
- jolt/version.py,sha256=g0nt1ve0ZDcY6rT7-EKeTacBTtSwRblQj1SdwoNDrIE,24
25
+ jolt/utils.py,sha256=2pS9W3wCPoRjnqBohrjwaBnEelF_0FrJZHxtxfRlXgU,20693
26
+ jolt/version.py,sha256=Fg1HfEWEMUadBCisnRaI9WfEC1Q385vVRIaaa85X79o,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
@@ -147,7 +147,7 @@ jolt/plugins/alias.py,sha256=8BXRTh1N6rGjEPk484Grelw2KPa4kLKX7LUt7bUArFI,399
147
147
  jolt/plugins/allure.py,sha256=gT46-L6ADsngemHzptALlDksp2VPRLj-0wAgPpH8qfM,10266
148
148
  jolt/plugins/autotools.py,sha256=ZIKMsmCspZbfmoDx3enelrLidXvFruAYaY2FB2k1xM4,1813
149
149
  jolt/plugins/autoweight.py,sha256=LTpma3HM1jsAx1PatDIWcddAkRw1SPhHA4Dl9H9p2lo,1245
150
- jolt/plugins/cache.py,sha256=8voIlVS4fjJnQE1uMA4BvHJ2B4CQQXUF93IW-_if7fs,4242
150
+ jolt/plugins/cache.py,sha256=ADDHwsqL1hU0vSN9DATBQTGi9UFCXudWcM6ScCIrpok,4247
151
151
  jolt/plugins/cmake.py,sha256=uW314RSuoh-j6HVW8ghTJjsh3tj2K18PZr6nBeelSBU,4674
152
152
  jolt/plugins/conan.py,sha256=5d7TdQBV1dcwTFfyW-U3jrfJDTpLbnp08Ltra1zTZyc,16259
153
153
  jolt/plugins/cxx.py,sha256=UqcBIcjCphRB2ojknU4v5vRv_6i3CmIAFZS1T3dXWVc,30487
@@ -178,8 +178,8 @@ jolt/plugins/podman.py,sha256=7xrPWaJvSzsBSsEUaCwBfVtMfzx5pLUrZB7pxf8hLzs,22487
178
178
  jolt/plugins/python.py,sha256=DnouYOl2x2iZ_bnUmx5XesNIOUqSCzSg_NC6KgOZW4A,7769
179
179
  jolt/plugins/report.py,sha256=EiPuZSoxEM-fXDsHBQuRTf1xtvN_gPBodMej3E9CGx0,2695
180
180
  jolt/plugins/rust.py,sha256=xPhiUmKtAnr9RbQwkAiyFdXc3KyMrqSmo98kYtHI0rc,713
181
- jolt/plugins/scheduler.py,sha256=SJdRb0taOF4zhKkPfc9zg8UyvDn7rJYtbyMPC93XXsk,24560
182
- jolt/plugins/selfdeploy.py,sha256=oYeBefUfabf-ACEVbdyJi2n9SfAuXLK1Q12D35obZsw,6952
181
+ jolt/plugins/scheduler.py,sha256=EzJtTUYv9bqjiDoUNX1fD1NWvXfwbm6X_BVw_vtpGLM,25312
182
+ jolt/plugins/selfdeploy.py,sha256=nK8d4wsenenEzNE6jcPCVI2yl_C3amYx8-2MIrSYxCY,6957
183
183
  jolt/plugins/strings.py,sha256=sHDroW0srlQI1aRwu_WANkmR35sUxPvZGO28CYo-ClY,1783
184
184
  jolt/plugins/symlinks.py,sha256=u4lTcpkepf0_mr_RI85uiSkI_WAUGebAOsbH5WlAnzo,2399
185
185
  jolt/plugins/telemetry.py,sha256=xHgJVbSVRaPy67kblL4wj86mDESlFS1z3NGDJ2uDXZ8,3572
@@ -202,8 +202,8 @@ jolt/templates/cxxexecutable.cmake.template,sha256=f0dg1VOFlamlF8fuHFTki5dsJ2ssS
202
202
  jolt/templates/cxxlibrary.cmake.template,sha256=GMEG2G3QoY3E5fsNer52zOqgM221-abeCkV__mVbZ94,1750
203
203
  jolt/templates/export.sh.template,sha256=PKkflGXFbq70EIsowqcnLvzbnEDnqh_WgC4E_JNT0VE,1937
204
204
  jolt/templates/timeline.html.template,sha256=xdqvFBmhE8XRQaWgcIFBVbd__9HdRq6O-U0o276PyjU,1222
205
- jolt-0.9.449.dist-info/METADATA,sha256=HvB1XTqSfPlHzv6XXzWoYxHBqqgrsOY109i8TynNYoE,7252
206
- jolt-0.9.449.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
207
- jolt-0.9.449.dist-info/entry_points.txt,sha256=VZ-QH38Z9HJc1O57wfzr-soHn6exwc3N0TSrRum4tYg,44
208
- jolt-0.9.449.dist-info/top_level.txt,sha256=HwzVmAwUrvCUUHRi3zUfcpdKTsdNrZmPCvsrsWSFyqE,5
209
- jolt-0.9.449.dist-info/RECORD,,
205
+ jolt-0.9.452.dist-info/METADATA,sha256=AhCjkI9aq4fssBUdAPNsNrMiI19Q-JhQ4J000RX6_RQ,7252
206
+ jolt-0.9.452.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
207
+ jolt-0.9.452.dist-info/entry_points.txt,sha256=VZ-QH38Z9HJc1O57wfzr-soHn6exwc3N0TSrRum4tYg,44
208
+ jolt-0.9.452.dist-info/top_level.txt,sha256=HwzVmAwUrvCUUHRi3zUfcpdKTsdNrZmPCvsrsWSFyqE,5
209
+ jolt-0.9.452.dist-info/RECORD,,
File without changes