Skip to content

Task module

TaskActions

Bases: BaseAction

Tasks actions

create_tasks(project_id, batch_id, tasks, disable_progress_bar=False, disable_data_check=False, disable_unicity_check=False, raise_if_existing=True, compatibility_mode=None)

Create tasks in a batch

Parameters:

Name Type Description Default
project_id str

ID of the project

required
batch_id str

ID of the batch project

required
tasks List[Dict]

List of the tasks to create. See TaskPayload(name : str, resource : str, data : Dict[str, Any])

required
disable_progress_bar Optional[bool]

Disable the progress bar display

False
disable_data_check Optional[bool]

Set this option to False to ignore the data format validation

False
disable_unicity_check Optional[bool]

Set this option to True to ignore duplicate check and insert it anyway

False
raise_if_existing Optional[bool]

Set this option to False to skip task duplicates and only show a warning

True
compatibility_mode Optional[TaskCompatibilityMode]

Format the output for specific use cases Possible choices: kili -> format the ouput to look like kili.assets() results

None

export_tasks(project_id, format, output_folder=None, output_filename=None, in_memory=False, options={}, batch_id_in=None, status_in=None, task_id_in=None, name_in=None, name_like=None, created_at_gt=None, created_at_gte=None, created_at_lt=None, created_at_lte=None, updated_at_gt=None, updated_at_gte=None, updated_at_lt=None, updated_at_lte=None, disable_progress_bar=False)

Get an task list

Parameters:

Name Type Description Default
project_id ProjectId

ID of the project

required
format ExportFormat

Export format Possible choices: lab, kili, yolo, mask

required
output_folder Optional[str]

Path to the folder where the export will be saved

None
output_filename Optional[str]

name of the export

None
in_memory Optional[bool]

Return the result instead of saving it on file system

False
options Optional[Dict]

Specific options according to the format (see documentation)

{}
batch_id_in Optional[List[str]]

A list of batch ids to filter

None
status_in Optional[List[str]]

Only in those statuses. Possible choices: pending, complete, to-review, reviewed, configuring.

None
task_id_in Optional[List[str]]

Only task whose ID is in this list,

None
name_in Optional[List[str]]

Only task whose name is in this list,

None
name_like Optional[str]

Only task whose name mathes this regex,

None
created_at_gt Optional[str]

Only tasks created after this date (Ex.: "2022-09-19 08:30:00")

None
created_at_gte Optional[str]

Only tasks created at or after this date (Ex.: "2022-09-19 08:30:00")

None
created_at_lt Optional[str]

Only tasks created before this date (Ex.: "2022-09-19 08:30:00")

None
created_at_lte Optional[str]

Only tasks created at or before this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_gt Optional[str]

Only tasks updated after this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_gte Optional[str]

Only tasks updated at or after this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_lt Optional[str]

Only tasks updated before this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_lte Optional[str]

Only tasks updated at or before this date (Ex.: "2022-09-19 08:30:00")

None
disable_progress_bar Optional[bool]

Disable the progress bar display

False

tasks(project_id, batch_id_in=None, status_in=None, task_id_in=None, name_in=None, name_like=None, created_at_gt=None, created_at_gte=None, created_at_lt=None, created_at_lte=None, updated_at_gt=None, updated_at_gte=None, updated_at_lt=None, updated_at_lte=None, optional_fields=['data'], disable_progress_bar=False, compatibility_mode=None, raw_data=False, iterate=False)

Get an task list

No data by default

Add "data" in the optional_fields if you want to get your task data

Parameters:

Name Type Description Default
project_id ProjectId

ID of the project

required
batch_id_in Optional[List[str]]

A list of batch ids to filter

None
status_in Optional[List[str]]

Only in those statuses. Possible choices: pending, complete, to-review, reviewed, configuring.

None
task_id_in Optional[List[str]]

Only task whose ID is in this list,

None
name_in Optional[List[str]]

Only task whose name is in this list,

None
name_like Optional[str]

Only task whose name mathes this regex,

None
created_at_gt Optional[str]

Only tasks created after this date (Ex.: "2022-09-19 08:30:00")

None
created_at_gte Optional[str]

Only tasks created at or after this date (Ex.: "2022-09-19 08:30:00")

None
created_at_lt Optional[str]

Only tasks created before this date (Ex.: "2022-09-19 08:30:00")

None
created_at_lte Optional[str]

Only tasks created at or before this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_gt Optional[str]

Only tasks updated after this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_gte Optional[str]

Only tasks updated at or after this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_lt Optional[str]

Only tasks updated before this date (Ex.: "2022-09-19 08:30:00")

None
updated_at_lte Optional[str]

Only tasks updated at or before this date (Ex.: "2022-09-19 08:30:00")

None
optional_fields Optional[List[TaskOptionalFields]]

retreive those additional information Possible choices: data, jobs, metrics, data.mask(for segmentation project).

['data']
disable_progress_bar Optional[bool]

Disable the progress bar display

False
compatibility_mode Optional[TaskCompatibilityMode]

Format the output for specific use cases Possible choices: kili -> format the ouput to look like kili.assets() results

None
raw_data Optional[bool]

Get raw data and metadata object instead of merged data

False
iterate Optional[bool]

Return a generator

False

Returns:

Type Description
Union[Generator[Iterable[Dict], None, None], Iterable[Dict]]

List (or Generator) of tasks representations

update_properties_of_tasks(project_id, task_id_in, properties, disable_progress_bar=False)

Update properties of tasks

Parameters:

Name Type Description Default
project_id str

ID of the project

required
task_id_in List[str]

List of the IDs of the tasks to update

required
properties Dict[str, Any]

Dict of properties Possible keys : score

required
disable_progress_bar Optional[bool]

Disable the progress bar display

False

Example

from isahitlab.client import IsahitLab

lab = IsahitLab()

lab.update_properties_of_tasks(
            project_id='<project_id>', 
            task_id_in=['<task_id_1>', '<task_id_2>'],
            properties={
                "score": 5
            }
)

TaskPayload dataclass

Bases: dict

Task payload for task creation

Parameters:

Name Type Description Default
name str

Name of the task (should be unique in a batch)

required
resources Optional[List[str]]

Path or URL of a resource (ex.: "./images/image1.jpg", "https:://domain.com/image1.jpg")

required
data Dict[str, Any]

Initial data for the task (depends on project type and configuration)

required