def main(self): args = self.args project_id = args.project_id super().validate_project( project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.TRAINING_DATA_USER]) if args.task_json is not None: task_json_path = args.task_json else: wait_options = get_wait_options_from_args( get_json_from_args(args.wait_options), DEFAULT_WAIT_OPTIONS) cache_dir = annofabcli.utils.get_cache_dir() task_json_path = cache_dir / f"{project_id}-task.json" downloading_obj = DownloadingFile(self.service) downloading_obj.download_task_json(project_id, dest_path=str(task_json_path), is_latest=args.latest, wait_options=wait_options) with open(task_json_path, encoding="utf-8") as f: task_list = json.load(f) df = self.create_summary_df(project_id, task_list) if len(df) > 0: self.print_summarize_df(df) else: logger.error(f"出力対象データが0件のため、出力しません。")
def main(self): args = self.args project_id = args.project_id super().validate_project(project_id, [ProjectMemberRole.OWNER, ProjectMemberRole.TRAINING_DATA_USER]) if args.task_json is not None: task_json_path = args.task_json else: wait_options = get_wait_options_from_args(get_json_from_args(args.wait_options), DEFAULT_WAIT_OPTIONS) cache_dir = annofabcli.utils.get_cache_dir() task_json_path = cache_dir / f"{project_id}-task.json" downloading_obj = DownloadingFile(self.service) downloading_obj.download_task_json( project_id, dest_path=str(task_json_path), is_latest=args.latest, wait_options=wait_options ) with open(task_json_path, encoding="utf-8") as f: task_list = json.load(f) main_obj = PrintDashBoardMain(self.service) dashboard_date = main_obj.create_dashboard_data(project_id, date=args.date, task_list=task_list) annofabcli.utils.print_according_to_format( dashboard_date.to_dict(), arg_format=FormatArgument(self.str_format), output=self.output, )
def main(self): args = self.args project_id = args.project_id wait_options = get_wait_options_from_args(get_json_from_args(args.wait_options), DEFAULT_WAIT_OPTIONS) task_json_path = Path(args.task_json) if args.task_json is not None else None self.summarize_task_count( project_id, task_json_path=task_json_path, is_latest=args.latest, wait_options=wait_options )
def main(self): args = self.args project_id = args.project_id super().validate_project(project_id, project_member_roles=None) if args.annotation is not None: annotation_path = Path(args.annotation) else: cache_dir = annofabcli.utils.get_cache_dir() annotation_path = cache_dir / f"annotation-{project_id}.zip" wait_options = get_wait_options_from_args( get_json_from_args(args.wait_options), DEFAULT_WAIT_OPTIONS) downloading_obj = DownloadingFile(self.service) downloading_obj.download_annotation_zip( project_id, dest_path=str(annotation_path), is_latest=args.latest, wait_options=wait_options, ) task_id_set = set( annofabcli.common.cli.get_list_from_args( args.task_id)) if args.task_id is not None else None task_query = (TaskQuery.from_dict( annofabcli.common.cli.get_json_from_args(args.task_query)) if args.task_query is not None else None) group_by = GroupBy(args.group_by) if group_by == GroupBy.TASK_ID: self.list_annotation_count_by_task( project_id, annotation_path=annotation_path, output_dir=Path(args.output_dir), task_id_set=task_id_set, task_query=task_query, ) elif group_by == GroupBy.INPUT_DATA_ID: self.list_annotation_count_by_input_data( project_id, annotation_path=annotation_path, output_dir=Path(args.output_dir), task_id_set=task_id_set, task_query=task_query, )