DIRAC 9.0.0a67__py3-none-any.whl → 9.0.0a68__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.
@@ -1,11 +1,14 @@
1
1
  """ Helper for the CS Resources section
2
2
  """
3
- import re
4
3
  from urllib import parse
5
4
 
6
5
  from DIRAC import S_ERROR, S_OK, gConfig, gLogger
7
6
  from DIRAC.ConfigurationSystem.Client.Helpers.Path import cfgPath
8
7
  from DIRAC.Core.Utilities.List import fromChar, uniqueElements
8
+ from DIRACCommon.ConfigurationSystem.Client.Helpers.Resources import (
9
+ getDIRACPlatform as _getDIRACPlatform,
10
+ _platformSortKey,
11
+ )
9
12
 
10
13
  gBaseResourcesSection = "/Resources"
11
14
 
@@ -328,8 +331,8 @@ def getCompatiblePlatforms(originalPlatforms):
328
331
  if not (result["OK"] and result["Value"]):
329
332
  return S_ERROR("OS compatibility info not found")
330
333
 
331
- platformsDict = {k: v.replace(" ", "").split(",") for k, v in result["Value"].items()} # can be an iterator
332
- for k, v in platformsDict.items(): # can be an iterator
334
+ platformsDict = {k: v.replace(" ", "").split(",") for k, v in result["Value"].items()}
335
+ for k, v in platformsDict.items():
333
336
  if k not in v:
334
337
  v.append(k)
335
338
 
@@ -355,7 +358,6 @@ def getDIRACPlatform(OSList):
355
358
  :param list OSList: list of platforms defined by resource providers
356
359
  :return: a list of DIRAC platforms that can be specified in job descriptions
357
360
  """
358
-
359
361
  # For backward compatibility allow a single string argument
360
362
  osList = OSList
361
363
  if isinstance(OSList, str):
@@ -365,31 +367,12 @@ def getDIRACPlatform(OSList):
365
367
  if not (result["OK"] and result["Value"]):
366
368
  return S_ERROR("OS compatibility info not found")
367
369
 
368
- platformsDict = {k: v.replace(" ", "").split(",") for k, v in result["Value"].items()} # can be an iterator
369
- for k, v in platformsDict.items(): # can be an iterator
370
+ platformsDict = {k: set(v.replace(" ", "").split(",")) for k, v in result["Value"].items()}
371
+ for k, v in platformsDict.items():
370
372
  if k not in v:
371
- v.append(k)
372
-
373
- # making an OS -> platforms dict
374
- os2PlatformDict = dict()
375
- for platform, osItems in platformsDict.items(): # can be an iterator
376
- for osItem in osItems:
377
- if os2PlatformDict.get(osItem):
378
- os2PlatformDict[osItem].append(platform)
379
- else:
380
- os2PlatformDict[osItem] = [platform]
381
-
382
- platforms = []
383
- for os in osList:
384
- if os in os2PlatformDict:
385
- platforms += os2PlatformDict[os]
386
-
387
- if not platforms:
388
- return S_ERROR(f"No compatible DIRAC platform found for {','.join(OSList)}")
373
+ v.add(k)
389
374
 
390
- platforms.sort(key=_platformSortKey, reverse=True)
391
-
392
- return S_OK(platforms)
375
+ return _getDIRACPlatform(osList, platformsDict)
393
376
 
394
377
 
395
378
  def getDIRACPlatforms():
@@ -451,7 +434,7 @@ def getInfoAboutProviders(of=None, providerName=None, option="", section=""):
451
434
  result = gConfig.getConfigurationTree(relPath)
452
435
  if not result["OK"]:
453
436
  return result
454
- for key, value in result["Value"].items(): # can be an iterator
437
+ for key, value in result["Value"].items():
455
438
  if value:
456
439
  resDict[key.replace(relPath, "")] = value
457
440
  return S_OK(resDict)
@@ -459,18 +442,3 @@ def getInfoAboutProviders(of=None, providerName=None, option="", section=""):
459
442
  return gConfig.getSections(f"{gBaseResourcesSection}/{of}Providers/{providerName}/{section}/")
460
443
  else:
461
444
  return S_OK(gConfig.getValue(f"{gBaseResourcesSection}/{of}Providers/{providerName}/{section}/{option}"))
462
-
463
-
464
- def _platformSortKey(version: str) -> list[str]:
465
- # Loosely based on distutils.version.LooseVersion
466
- parts = []
467
- for part in re.split(r"(\d+|[a-z]+|\.| -)", version.lower()):
468
- if not part or part == ".":
469
- continue
470
- if part[:1] in "0123456789":
471
- part = part.zfill(8)
472
- else:
473
- while parts and parts[-1] == "00000000":
474
- parts.pop()
475
- parts.append(part)
476
- return parts
@@ -9,7 +9,6 @@ from DIRAC.ConfigurationSystem.Client import ConfigurationData
9
9
  from DIRAC.ConfigurationSystem.Client.Helpers.Resources import (
10
10
  getDIRACPlatform,
11
11
  getCompatiblePlatforms,
12
- _platformSortKey,
13
12
  getQueue,
14
13
  )
15
14
 
@@ -77,21 +76,6 @@ def test_getDIRACPlatform(mocker, mockGCReplyInput, requested, expectedRes, expe
77
76
  assert set(res["Value"]) == set(expectedValue), res["Value"]
78
77
 
79
78
 
80
- @pytest.mark.parametrize(
81
- "string,expected",
82
- [
83
- ("Darwin_arm64_12.4", ["darwin", "_", "arm", "64", "_", "12", "4"]),
84
- ("Linux_x86_64_glibc-2.17", ["linux", "_", "x", "86", "_", "64", "_", "glibc", "-", "2", "17"]),
85
- ("Linux_aarch64_glibc-2.28", ["linux", "_", "aarch", "64", "_", "glibc", "-", "2", "28"]),
86
- ],
87
- )
88
- def test_platformSortKey(string, expected):
89
- actual = _platformSortKey(string)
90
- for a, e in zip_longest(actual, expected):
91
- # Numbers are padded with zeros so string comparison works
92
- assert a.lstrip("0") == e
93
-
94
-
95
79
  @pytest.mark.parametrize(
96
80
  "mockGCReplyInput, requested, expectedRes, expectedValue",
97
81
  [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DIRAC
3
- Version: 9.0.0a67
3
+ Version: 9.0.0a68
4
4
  Summary: DIRAC is an interware, meaning a software framework for distributed computing.
5
5
  Home-page: https://github.com/DIRACGrid/DIRAC/
6
6
  License: GPL-3.0-only
@@ -19,7 +19,7 @@ Requires-Dist: cachetools
19
19
  Requires-Dist: certifi
20
20
  Requires-Dist: cwltool
21
21
  Requires-Dist: diraccfg
22
- Requires-Dist: DIRACCommon==v9.0.0a67
22
+ Requires-Dist: DIRACCommon==v9.0.0a68
23
23
  Requires-Dist: diracx-client>=v0.0.1a18
24
24
  Requires-Dist: diracx-core>=v0.0.1a18
25
25
  Requires-Dist: db12
@@ -67,10 +67,10 @@ DIRAC/ConfigurationSystem/Client/Helpers/CSGlobals.py,sha256=_txOWvYqcRzK4n4VVEw
67
67
  DIRAC/ConfigurationSystem/Client/Helpers/Operations.py,sha256=jrpeauEwV6_xXQwVEbs6DDboB8oUmzkZkB_Xg8ZgdBQ,5991
68
68
  DIRAC/ConfigurationSystem/Client/Helpers/Path.py,sha256=ghRMD2qNaKejwg4RZ3m4LzfCG5bg1afvTnwJQydl94w,930
69
69
  DIRAC/ConfigurationSystem/Client/Helpers/Registry.py,sha256=svibVaHyRKRKPEs-k4pXgcTzr74qe72m4jo2Ue9Xqts,20775
70
- DIRAC/ConfigurationSystem/Client/Helpers/Resources.py,sha256=8llG-BevyD33S6nYpQjr1LQxdCqyJcS1U8vLBUrT3HY,16641
70
+ DIRAC/ConfigurationSystem/Client/Helpers/Resources.py,sha256=g6ZRdAydAnyKHjL9Gh6VS-jP5zb64q7uMOohtn8rin8,15604
71
71
  DIRAC/ConfigurationSystem/Client/Helpers/ResourcesDefaults.py,sha256=m6s-ZvjtYcLGsuu6mkCpIzxA8rEUYnwOOw1HvjecuJQ,3314
72
72
  DIRAC/ConfigurationSystem/Client/Helpers/__init__.py,sha256=syOASwgkZHn6b6ybYYu15wO8mrZXj7T-gIHk3EDlpjc,206
73
- DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py,sha256=PVq5SirQDSh-m3WnfiBAylpj9w3NzAxdBQRWBf1FXWw,6142
73
+ DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py,sha256=_pfEyd5tw5OGCluNWT8cN2PIX_XEr1gLZPHPXEG0zXs,5543
74
74
  DIRAC/ConfigurationSystem/Client/SyncPlugins/CERNLDAPSyncPlugin.py,sha256=p1gSEKMY85dMQvJST5oDQiUeeMedMCSUdXyRThE8hgo,3376
75
75
  DIRAC/ConfigurationSystem/Client/SyncPlugins/DummySyncPlugin.py,sha256=hGXcNMxh3r7sCXkTs5r1Mlvz6FjlZ1lBo9NzavQzoBo,1420
76
76
  DIRAC/ConfigurationSystem/Client/SyncPlugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1294,9 +1294,9 @@ DIRAC/tests/Workflow/Integration/exe-script.py,sha256=B_slYdTocEzqfQLRhwuPiLyYUn
1294
1294
  DIRAC/tests/Workflow/Integration/helloWorld.py,sha256=tBgEHH3ZF7ZiTS57gtmm3DW-Qxgm_57HWHpM-Y8XSws,205
1295
1295
  DIRAC/tests/Workflow/Regression/helloWorld.py,sha256=69eCgFuVSYo-mK3Dj2dw1c6g86sF5FksKCf8V2aGVoM,509
1296
1296
  DIRAC/tests/Workflow/Regression/helloWorld.xml,sha256=xwydIcFTAHIX-YPfQfyxuQ7hzvIO3IhR3UAF7ORgkGg,5310
1297
- dirac-9.0.0a67.dist-info/licenses/LICENSE,sha256=uyr4oV6jmjUeepXZPPjkJRwa5q5MrI7jqJz5sVXNblQ,32452
1298
- dirac-9.0.0a67.dist-info/METADATA,sha256=KsoeED4NaIZwsKIfB0lKcpwodmhirv2SVHYYUWTMMPQ,10020
1299
- dirac-9.0.0a67.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1300
- dirac-9.0.0a67.dist-info/entry_points.txt,sha256=hupzIL8aVmjK3nn7RLKdhcaiPmLOiD3Kulh3CSDHKmw,16492
1301
- dirac-9.0.0a67.dist-info/top_level.txt,sha256=RISrnN9kb_mPqmVu8_o4jF-DSX8-h6AcgfkO9cgfkHA,6
1302
- dirac-9.0.0a67.dist-info/RECORD,,
1297
+ dirac-9.0.0a68.dist-info/licenses/LICENSE,sha256=uyr4oV6jmjUeepXZPPjkJRwa5q5MrI7jqJz5sVXNblQ,32452
1298
+ dirac-9.0.0a68.dist-info/METADATA,sha256=lajHXRmL_O4jHTBhxb0BnpTkzbY-Fvco4bJO9j0puvg,10020
1299
+ dirac-9.0.0a68.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1300
+ dirac-9.0.0a68.dist-info/entry_points.txt,sha256=hupzIL8aVmjK3nn7RLKdhcaiPmLOiD3Kulh3CSDHKmw,16492
1301
+ dirac-9.0.0a68.dist-info/top_level.txt,sha256=RISrnN9kb_mPqmVu8_o4jF-DSX8-h6AcgfkO9cgfkHA,6
1302
+ dirac-9.0.0a68.dist-info/RECORD,,