[docs]defmain(argv:list[str]|None=None)->int:"""Entry point for import tools when invoked as a cli tool."""parser=argparse.ArgumentParser(description="Import datasets into GPF",formatter_class=argparse.RawTextHelpFormatter,)parser.add_argument("config",type=str,help="Path to the import configuration")TaskGraphCli.add_arguments(parser,default_task_status_dir=None)VerbosityConfiguration.set_arguments(parser)args=parser.parse_args(argvorsys.argv[1:])VerbosityConfiguration.set(args)project=ImportProject.build_from_file(args.config)ifargs.task_status_dirisNone:args.task_status_dir=fs_utils.join(project.work_dir,".task-progress",project.study_id)storage=project.get_import_storage()task_graph=storage.generate_import_task_graph(project)task_graph.input_files.extend(project.config_filenames)ifTaskGraphCli.process_graph(task_graph,**vars(args)):return0return1
[docs]defrun_with_project(project:ImportProject,executor:AbstractTaskGraphExecutor|None=None,)->bool:"""Run import with the given project."""ifexecutorisNone:executor=SequentialExecutor()storage=project.get_import_storage()task_graph=storage.generate_import_task_graph(project)task_graph.input_files.extend(project.config_filenames)returntask_graph_run(task_graph,executor,keep_going=False)