Skip to content

Commit 58bb3ad

Browse files
committed
Revert "correct executable permissions addition for user and group"
This reverts commit 6a20fc3.
1 parent 6a20fc3 commit 58bb3ad

File tree

7 files changed

+14
-24
lines changed

7 files changed

+14
-24
lines changed

jobqueues/celeryfiles/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from celery.exceptions import SoftTimeLimitExceeded
22
from billiard import current_process
3-
from jobqueues.util import _getVisibleGPUdevices, _make_executable
3+
from jobqueues.util import _getVisibleGPUdevices
44

55

66
visibledevs = _getVisibleGPUdevices()
@@ -105,4 +105,4 @@ def _createJobScript(
105105
if os.path.abspath(odir) != os.path.abspath(workdir):
106106
f.write("\nmv {} {}".format(" ".join(copyextensions), odir))
107107

108-
_make_executable(fname)
108+
os.chmod(fname, 0o700)

jobqueues/localqueue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# No redistribution in whole or part
55
#
66
from jobqueues.simqueue import SimQueue
7-
from jobqueues.util import _getGPUdevices, _filterVisibleGPUdevices, _make_executable
7+
from jobqueues.util import _getGPUdevices, _filterVisibleGPUdevices
88
from protocolinterface import val
99
import queue
1010
import os
@@ -137,7 +137,7 @@ def _createJobScript(self, fname, workdir, runsh, gpudevice=None):
137137
if os.path.abspath(odir) != os.path.abspath(workdir):
138138
f.write("\nmv {} {}".format(" ".join(self.copy), odir))
139139

140-
_make_executable(fname)
140+
os.chmod(fname, 0o700)
141141

142142
def _setRunning(self, path):
143143
self._states[path] = "R"
@@ -433,7 +433,7 @@ def _getmemory(self):
433433
from math import floor
434434
import psutil
435435

436-
memory = psutil.virtual_memory().total / 1024**2
436+
memory = psutil.virtual_memory().total / 1024 ** 2
437437
memory *= max(0, min(1, self.ncpu / psutil.cpu_count())) # Clamp to [0, 1]
438438
memory = int(floor(memory))
439439

jobqueues/lsfqueue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from subprocess import check_output, CalledProcessError, DEVNULL
1111
from protocolinterface import val
1212
from jobqueues.simqueue import SimQueue
13-
from jobqueues.util import ensurelist, _make_executable
13+
from jobqueues.util import ensurelist
1414
from jobqueues.config import loadConfig
1515
import unittest
1616
import yaml
@@ -279,7 +279,7 @@ def _createJobScript(self, fname, workdir, runsh):
279279
os.makedirs(datadir, exist_ok=True)
280280
f.write(f"\nmv *.{self.trajext} {datadir}")
281281

282-
_make_executable(fname)
282+
os.chmod(fname, 0o700)
283283

284284
def retrieve(self):
285285
# Nothing to do

jobqueues/pbsqueue.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from protocolinterface import val
1212
from jobqueues.simqueue import SimQueue
1313
from jobqueues.config import loadConfig
14-
from jobqueues.util import _make_executable
1514
import logging
1615

1716
logger = logging.getLogger(__name__)
@@ -187,7 +186,7 @@ def _createJobScript(self, fname, workdir, runsh):
187186
os.makedirs(datadir, exist_ok=True)
188187
f.write(f"\nmv *.{self.trajext} {datadir}")
189188

190-
_make_executable(fname)
189+
os.chmod(fname, 0o700)
191190

192191
def retrieve(self):
193192
# Nothing to do

jobqueues/sgequeue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from subprocess import check_output, CalledProcessError, DEVNULL
1111
from protocolinterface import val
1212
from jobqueues.simqueue import SimQueue
13-
from jobqueues.util import ensurelist, _make_executable
13+
from jobqueues.util import ensurelist
1414
from jobqueues.config import loadConfig
1515
from math import ceil
1616
import logging
@@ -223,7 +223,7 @@ def _createJobScript(self, fname, workdir, runsh):
223223
with open(fname, "w") as f:
224224
f.write(job_str)
225225

226-
_make_executable(fname)
226+
os.chmod(fname, 0o700)
227227

228228
def retrieve(self):
229229
# Nothing to do

jobqueues/slurmqueue.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import random
99
import string
1010
from jobqueues.config import loadConfig
11+
import yaml
1112
from subprocess import check_output, CalledProcessError
1213
from protocolinterface import val
1314
from jobqueues.simqueue import SimQueue, QueueJobStatus, _inProgressStatus
14-
from jobqueues.util import ensurelist, _make_executable
15+
from jobqueues.util import ensurelist
1516
import getpass
17+
import unittest
1618
import logging
1719

1820
logger = logging.getLogger(__name__)
@@ -400,7 +402,7 @@ def _createJobScript(self, fname, workdir, runsh, nvidia_mps=False, commands=Non
400402
)
401403
with open(fname, "w") as f:
402404
f.write(job_str)
403-
_make_executable(fname)
405+
os.chmod(fname, 0o700)
404406

405407
def retrieve(self):
406408
# Nothing to do

jobqueues/util.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,3 @@ def _filterVisibleGPUdevices(devices, _logger):
6262
# Only keep the selected visible devices. intersect of the two lists
6363
devices = [dd for dd in devices if dd in visible_devices]
6464
return devices
65-
66-
67-
def _make_executable(fname):
68-
import os
69-
import stat
70-
71-
# Get current permissions
72-
st = os.stat(fname)
73-
74-
# Add execute permission for user and group
75-
os.chmod(fname, st.st_mode | stat.S_IXUSR | stat.S_IXGRP)

0 commit comments

Comments
 (0)