import subprocess from garcon import task @task.decorate(timeout=7200) def pipe_gzip_from_stdin_to_stdout(activity, pipe): """Extract data from mysql to a file. Args: activity (ActivityWorker): The swf activity worker. pipe (Popen): Store pipe signal Return: dict: A dictionary with a Popen object """ p3 = subprocess.Popen(['gzip', '--stdout'], stdin=pipe.stdout, stdout=subprocess.PIPE) activity.logger.info('Setup of pipe_gzip_to_stdout pipe task done.') return dict(pipe=p3)