Skip to content

Commit c539308

Browse files
authored
Merge pull request #48 from SAP/pigz
Pigz
2 parents f8f3637 + b3aa64b commit c539308

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/job/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ RUN apk add --no-cache \
1313
bash \
1414
libc6-compat \
1515
openssh-client \
16-
git \
17-
pigz && \
16+
git && \
1817
pip install docker==2.0.1 awscli && \
1918
pip install docker-compose==1.20.1 future PyJWT && \
2019
apk del py-pip && \

src/job/job.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import uuid
1010
import base64
1111
import traceback
12-
import requests
1312

1413
from pyinfrabox.infrabox import validate_json
1514
from pyinfrabox.docker_compose import create_from
@@ -131,12 +130,20 @@ def flush(self):
131130
self.console.flush()
132131

133132
def compress(self, source, output):
134-
subprocess.check_call("tar cf - --directory %s . | pigz -n > %s" % (source, output), shell=True)
133+
try:
134+
cmd = ["tar", "cf", output, "."]
135+
subprocess.check_call(cmd, cwd=source)
136+
except subprocess.CalledProcessError as e:
137+
self.console.collect(e.output)
138+
raise
135139

136-
def uncompress(self, source, output, c):
137-
cmd = "pigz -dc %s | tar x -C %s" % (source, output)
138-
c.collect(cmd, show=True)
139-
subprocess.check_call(cmd, shell=True)
140+
def uncompress(self, source, output):
141+
try:
142+
cmd = ["tar", "xf", source]
143+
subprocess.check_call(cmd, cwd=output)
144+
except subprocess.CalledProcessError as e:
145+
self.console.collect(e.output)
146+
raise
140147

141148
def get_files_in_dir(self, d, ending=None):
142149
result = []
@@ -479,7 +486,7 @@ def main_run_job(self):
479486
c.collect("output found for %s\n" % dep['name'], show=True)
480487
infrabox_input_dir = os.path.join(self.infrabox_inputs_dir, dep['name'].split('/')[-1])
481488
os.makedirs(infrabox_input_dir)
482-
self.uncompress(storage_input_file_tar, infrabox_input_dir, c)
489+
self.uncompress(storage_input_file_tar, infrabox_input_dir)
483490
c.execute(['ls', '-alh', infrabox_input_dir], show=True)
484491
os.remove(storage_input_file_tar)
485492
else:

0 commit comments

Comments
 (0)