It is ok to output()
zip files like this:
def output(self):
date_path = self.search['date_path']
zip_fn = "data/%s/%s.zip" % (date_path, date_path)
return luigi.LocalTarget(zip_fn)
But how to pas this zip in run()
method?
class ZeroTask(luigi.Task):
path_in = luigi.Parameter()
textfiles = []
path_to_zip = ''
def requires(self):
return []
def run(self):
# Get a bunch of text files
# Do some manipulations with textfiles
# Create a result.zip
# self.path_to_zip = '~/Project/result.zip'
def output(self):
zip_fn = self.path_to_result.zip
return luigi.LocalTarget(zip_fn)
What should I do in the run()
method?
You should be able to use
zipfile
to build the file however you'd like.From the docs on FileSystemTarget,