|
1 |
| -""" Module holding function(s) creating the pilot wrapper. |
| 1 | +"""Module holding function(s) creating the pilot wrapper. |
2 | 2 |
|
3 |
| - This is a DIRAC-free module, so it could possibly be used also outside of DIRAC installations. |
| 3 | +This is a DIRAC-free module, so it could possibly be used also outside of DIRAC installations. |
4 | 4 |
|
5 |
| - The main client of this module is the SiteDirector, that invokes the functions here more or less like this:: |
| 5 | +The main client of this module is the SiteDirector, that invokes the functions here more or less like this:: |
6 | 6 |
|
7 |
| - pilotFilesCompressedEncodedDict = getPilotFilesCompressedEncodedDict(pilotFiles) |
8 |
| - localPilot = pilotWrapperScript(pilotFilesCompressedEncodedDict, |
9 |
| - pilotOptions, |
10 |
| - pilotExecDir) |
11 |
| - _writePilotWrapperFile(localPilot=localPilot) |
| 7 | + pilotFilesCompressedEncodedDict = getPilotFilesCompressedEncodedDict(pilotFiles) |
| 8 | + localPilot = pilotWrapperScript(pilotFilesCompressedEncodedDict, |
| 9 | + pilotOptions, |
| 10 | + pilotExecDir) |
| 11 | + _writePilotWrapperFile(localPilot=localPilot) |
12 | 12 |
|
13 | 13 | """
|
| 14 | + |
14 | 15 | from __future__ import absolute_import, division, print_function
|
15 | 16 |
|
16 | 17 | import base64
|
17 | 18 | import bz2
|
18 | 19 | import os
|
19 | 20 | import tempfile
|
20 | 21 |
|
| 22 | + |
21 | 23 | pilotWrapperContent = """#!/bin/bash
|
22 | 24 | # Reduce the maximum allowed number of open file descriptors as micromamba
|
23 | 25 | # gets stuck due to https://github.com/DaanDeMeyer/reproc/pull/103
|
@@ -411,7 +413,15 @@ def getPilotFilesCompressedEncodedDict(pilotFiles, proxy=None):
|
411 | 413 | pilotFilesCompressedEncodedDict[os.path.basename(pf)] = pfContentEncoded
|
412 | 414 |
|
413 | 415 | if proxy is not None:
|
414 |
| - compressedAndEncodedProxy = base64.b64encode(bz2.compress(proxy.dumpAllToString()["Value"].encode())) |
| 416 | + from pathlib import Path # pylint: disable=import-error |
| 417 | + from DIRAC.Core.Security.ProxyFile import writeChainToTemporaryFile # pylint: disable=import-error |
| 418 | + |
| 419 | + retVal = writeChainToTemporaryFile(proxy) |
| 420 | + proxyLocation = Path(retVal["Value"]) |
| 421 | + proxy_string = proxyLocation.read_text() |
| 422 | + proxyLocation.unlink() |
| 423 | + |
| 424 | + compressedAndEncodedProxy = base64.b64encode(bz2.compress(proxy_string.encode())) |
415 | 425 | pilotFilesCompressedEncodedDict["proxy"] = compressedAndEncodedProxy
|
416 | 426 |
|
417 | 427 | return pilotFilesCompressedEncodedDict
|
|
0 commit comments