示例#1
0
    for j, task_json_path in enumerate(taskgroup_json_paths):

        # periods not allowed in task names
        task_json_filename = ntpath.basename(task_json_path)
        task_json_filename_root = os.path.splitext(task_json_filename)[0]
        task_name = '{}_{}'.format(base_task_name,
                                   task_json_filename_root).replace('.', '_')
        if len(task_name) > max_task_name_length:
            long_task_name = task_name
            task_name = task_name[:max_task_name_length]
            print('Warning: task name {} too long, shortened to {}'.format(
                long_task_name, task_name))
        assert task_name not in task_names
        task_names.add(task_name)
        task = prepare_api_submission.Task(name=task_name,
                                           images_list_path=task_json_path,
                                           api_url=endpoint_base)

        blob_name = 'api_inputs/{}/{}'.format(base_task_name,
                                              task_json_filename)
        print('Task {}: uploading {} to {}'.format(task_name, task_json_path,
                                                   blob_name))
        task.upload_images_list(account=storage_account_name,
                                container=container_name,
                                sas_token=read_write_sas_token,
                                blob_name=blob_name)

        taskgroup.append(task)

    taskgroups.append(taskgroup)
        # periods not allowed in task names
        task_json_filename = ntpath.basename(task_json_path)
        task_json_filename_root = os.path.splitext(task_json_filename)[0]
        task_name = f'{base_task_name}_{task_json_filename_root}'.replace(
            '.', '_')
        if task_name > max_task_name_length:
            long_task_name = task_name
            task_name = task_name[:max_task_name_length]
            print(
                f'Warning: task name {long_task_name} too long, shortened to '
                f'{task_name}.')
        assert task_name not in task_names
        task_names.add(task_name)
        task = prepare_api_submission.Task(name=task_name,
                                           images_list_path=task_json_path,
                                           api_url=ENDPOINT_BASE)

        blob_name = f'api_inputs/{base_task_name}/{task_json_filename}'
        print(f'Task {task_name}: uploading {task_json_path} to {blob_name}')
        task.upload_images_list(account=storage_account_name,
                                container=container_name,
                                sas_token=read_write_sas_token,
                                blob_name=blob_name)

        taskgroup.append(task)

    taskgroups.append(taskgroup)

assert len(taskgroups) == len(folder_names)
示例#3
0
    for j, task_json_path in enumerate(taskgroup_json_paths):

        # periods not allowed in task names
        task_json_filename = ntpath.basename(task_json_path)
        task_json_filename_root = os.path.splitext(task_json_filename)[0]
        task_name = '{}_{}'.format(base_task_name,
                                   task_json_filename_root).replace('.', '_')
        if len(task_name) > max_task_name_length:
            long_task_name = task_name
            task_name = task_name[:max_task_name_length]
            print('Warning: task name {} too long, shortened to {}'.format(
                long_task_name, task_name))
        assert task_name not in task_names
        task_names.add(task_name)
        task = prepare_api_submission.Task(name=task_name,
                                           images_list_path=task_json_path,
                                           api_url=endpoint_base)

        blob_name = 'api_inputs/{}/{}'.format(base_task_name,
                                              task_json_filename)
        print('Task {}: uploading {} to {}'.format(task_name, task_json_path,
                                                   blob_name))
        task.upload_images_list(account=storage_account_name,
                                container=container_name,
                                sas_token=read_write_sas_token,
                                blob_name=blob_name)

        taskgroup.append(task)

    taskgroups.append(taskgroup)