add --project_id argument for create task (#3090)

main
Adam Harvey 5 years ago committed by GitHub
parent 4db05fd93b
commit d9f1798684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -66,16 +66,20 @@ class CLI():
completion_verification_period=20, completion_verification_period=20,
git_completion_verification_period=2, git_completion_verification_period=2,
dataset_repository_url='', dataset_repository_url='',
project_id=None,
lfs=False, **kwargs): lfs=False, **kwargs):
""" Create a new task with the given name and labels JSON and """ Create a new task with the given name and labels JSON and
add the files to it. """ add the files to it. """
url = self.api.tasks url = self.api.tasks
labels = [] if project_id is not None else labels
data = {'name': name, data = {'name': name,
'labels': labels, 'labels': labels,
'overlap': overlap, 'overlap': overlap,
'segment_size': segment_size, 'segment_size': segment_size,
'bug_tracker': bug, 'bug_tracker': bug,
} }
if project_id:
data.update({'project_id': project_id})
response = self.session.post(url, json=data) response = self.session.post(url, json=data)
response.raise_for_status() response.raise_for_status()
response_json = response.json() response_json = response.json()

@ -112,6 +112,12 @@ task_create_parser.add_argument(
type=parse_label_arg, type=parse_label_arg,
help='string or file containing JSON labels specification' help='string or file containing JSON labels specification'
) )
task_create_parser.add_argument(
'--project',
default=None,
type=int,
help='project ID if project exists'
)
task_create_parser.add_argument( task_create_parser.add_argument(
'--overlap', '--overlap',
default=0, default=0,
@ -175,6 +181,7 @@ task_create_parser.add_argument(
action='store_true', action='store_true',
help='using lfs for dataset repository (default: %(default)s)' help='using lfs for dataset repository (default: %(default)s)'
) )
####################################################################### #######################################################################
# Delete # Delete
####################################################################### #######################################################################

Loading…
Cancel
Save