Add a switch for zip functionality

This commit is contained in:
Patrick Jentsch 2020-02-03 15:02:26 +01:00
parent 5f20f9be40
commit e4ef4835e5

13
nlp
View File

@ -35,6 +35,14 @@ def parse_arguments():
help='total number of cores available', help='total number of cores available',
required=False, required=False,
type=int) type=int)
parser.add_argument(
'--zip',
action='store_true',
default=False,
dest='zip',
help='package result files in zip bundles',
required=False
)
return parser.parse_args() return parser.parse_args()
@ -44,6 +52,7 @@ class NLPWorkflow(WorkflowRunner):
self.lang = args.lang self.lang = args.lang
self.n_cores = args.n_cores self.n_cores = args.n_cores
self.output_dir = args.output_dir self.output_dir = args.output_dir
self.zip = args.zip
def workflow(self): def workflow(self):
if len(self.jobs) == 0: if len(self.jobs) == 0:
@ -93,14 +102,14 @@ class NLPWorkflow(WorkflowRunner):
vrt_zip_jobs = [] vrt_zip_jobs = []
vrt_zip_job_dependencies = nlp_jobs vrt_zip_job_dependencies = nlp_jobs
cmd = 'cd "%s" && zip vrt.zip */*.vrt -x "pyflow.data*" && cd -' % ( cmd = 'cd "%s" && zip -m vrt.zip */*.vrt -x "pyflow.data*" && cd -' % (
self.output_dir self.output_dir
) )
vrt_zip_jobs.append( vrt_zip_jobs.append(
self.addTask( self.addTask(
command=cmd, command=cmd,
dependencies=vrt_zip_job_dependencies, dependencies=vrt_zip_job_dependencies,
label='vrt_zip_job_-_%i' % (index) label='vrt_zip_job'
) )
) )