Skip to content

Commit

Permalink
Merge pull request #48 from SAP/pigz
Browse files Browse the repository at this point in the history
Pigz
  • Loading branch information
ib-steffen authored Jun 17, 2018
2 parents f8f3637 + b3aa64b commit c539308
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/job/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ RUN apk add --no-cache \
bash \
libc6-compat \
openssh-client \
git \
pigz && \
git && \
pip install docker==2.0.1 awscli && \
pip install docker-compose==1.20.1 future PyJWT && \
apk del py-pip && \
Expand Down
21 changes: 14 additions & 7 deletions src/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import uuid
import base64
import traceback
import requests

from pyinfrabox.infrabox import validate_json
from pyinfrabox.docker_compose import create_from
Expand Down Expand Up @@ -131,12 +130,20 @@ def flush(self):
self.console.flush()

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

def uncompress(self, source, output, c):
cmd = "pigz -dc %s | tar x -C %s" % (source, output)
c.collect(cmd, show=True)
subprocess.check_call(cmd, shell=True)
def uncompress(self, source, output):
try:
cmd = ["tar", "xf", source]
subprocess.check_call(cmd, cwd=output)
except subprocess.CalledProcessError as e:
self.console.collect(e.output)
raise

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

0 comments on commit c539308

Please sign in to comment.