Skip to content

Commit ce87fcf

Browse files
committed
build docker args with list.append
instead of constructing new list objects every time the list has items appended to it, use python's list mutator functions (append and extend)
1 parent 92ae12f commit ce87fcf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vmms/localDocker.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ def runJob(self, vm, runTimeout, maxOutputFileSize, disableNetwork):
156156
os.getenv("DOCKER_TANGO_HOST_VOLUME_PATH"), instanceName
157157
)
158158
args = ["docker", "run", "--name", instanceName, "-v"]
159-
args = args + ["%s:%s" % (volumePath, "/home/mount")]
159+
args.append("%s:%s" % (volumePath, "/home/mount"))
160160
if vm.cores:
161-
args = args + [f"--cpus={vm.cores}"]
161+
args.append(f"--cpus={vm.cores}")
162162
if vm.memory:
163-
args = args + ["-m", f"{vm.memory}m"]
163+
args.extend(("-m", f"{vm.memory}m"))
164164
if disableNetwork:
165-
args = args + ["--network", "none"]
166-
args = args + [vm.image]
167-
args = args + ["sh", "-c"]
165+
args.append("--network", "none")
166+
args.append(vm.image)
167+
args.extend(("sh", "-c"))
168168

169169
autodriverCmd = (
170170
"autodriver -u %d -f %d -t %d -o %d autolab > output/feedback 2>&1"
@@ -176,11 +176,11 @@ def runJob(self, vm, runTimeout, maxOutputFileSize, disableNetwork):
176176
)
177177
)
178178

179-
args = args + [
179+
args.append(
180180
'cp -r mount/* autolab/; su autolab -c "%s"; \
181181
cp output/feedback mount/feedback'
182182
% autodriverCmd
183-
]
183+
)
184184

185185
self.log.debug("Running job: %s" % str(args))
186186
ret = timeout(args, runTimeout * 2)

0 commit comments

Comments
 (0)