mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/file-setup.git
synced 2024-12-27 03:44:19 +00:00
fix output_records.json generation
This commit is contained in:
parent
cdb4f1889c
commit
22a7217036
@ -66,7 +66,6 @@ class MainWorkflow(WorkflowRunner):
|
|||||||
self.input_dir = input_dir
|
self.input_dir = input_dir
|
||||||
self.output_dir = output_dir
|
self.output_dir = output_dir
|
||||||
self.jobs = []
|
self.jobs = []
|
||||||
self.collect_jobs()
|
|
||||||
|
|
||||||
def collect_jobs(self):
|
def collect_jobs(self):
|
||||||
for dir in os.listdir(self.input_dir):
|
for dir in os.listdir(self.input_dir):
|
||||||
@ -103,10 +102,11 @@ class MainWorkflow(WorkflowRunner):
|
|||||||
create_pdf_tasks.append(task)
|
create_pdf_tasks.append(task)
|
||||||
|
|
||||||
self.waitForTasks()
|
self.waitForTasks()
|
||||||
|
output_files = []
|
||||||
for job in self.jobs:
|
for job in self.jobs:
|
||||||
# Track output files
|
# Track output files
|
||||||
relative_output_dir = os.path.relpath(job.output_dir, start=self.output_dir) # noqa
|
relative_output_dir = os.path.relpath(job.output_dir, start=self.output_dir) # noqa
|
||||||
self.output_files.append(
|
output_files.append(
|
||||||
{
|
{
|
||||||
'description': 'PDF file without text layer.',
|
'description': 'PDF file without text layer.',
|
||||||
'file': os.path.join(relative_output_dir, '{}.pdf'.format(job.name)), # noqa
|
'file': os.path.join(relative_output_dir, '{}.pdf'.format(job.name)), # noqa
|
||||||
@ -114,7 +114,7 @@ class MainWorkflow(WorkflowRunner):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
with open(os.path.join(self.output_dir, 'output_records.json'), 'w') as f: # noqa
|
with open(os.path.join(self.output_dir, 'output_records.json'), 'w') as f: # noqa
|
||||||
json.dump(self.output_files, f, indent=4)
|
json.dump(output_files, f, indent=4)
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
@ -160,6 +160,7 @@ def parse_args():
|
|||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
main_workflow = MainWorkflow(args.input_dir, args.output_dir)
|
main_workflow = MainWorkflow(args.input_dir, args.output_dir)
|
||||||
|
main_workflow.collect_jobs()
|
||||||
retval = main_workflow.run(
|
retval = main_workflow.run(
|
||||||
dataDirRoot=args.log_dir, memMb=args.mem_mb, nCores=args.n_cores) # noqa
|
dataDirRoot=args.log_dir, memMb=args.mem_mb, nCores=args.n_cores) # noqa
|
||||||
sys.exit(retval)
|
sys.exit(retval)
|
||||||
|
Loading…
Reference in New Issue
Block a user