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], properties: Optional[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)

Export a list of task

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

send_tasks_to_redo(project_id, task_id_in, reset=False, disable_progress_bar=False)

Send tasks to redo

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 redo

required
reset Optional[bool]

Reset the task data to the initial data

False
disable_progress_bar Optional[bool]

Disable the progress bar display

False

send_tasks_to_review(project_id, task_id_in, disable_progress_bar=False)

Send tasks to review

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 review

required
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, data=None, properties=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 a list of tasks

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[TaskStatus]]

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
data Optional[Dict[str, Union[str, int, float]]]

Dict of data / input filters,

None
properties Optional[Dict[str, Union[str, int, float]]]

Dict of property filters,

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, custom

required
disable_progress_bar Optional[bool]

Disable the progress bar display

False

Custom properties

Some properties like score are known by the system. To add custom properties, pass a dictionnary of properties in properties.custom (see example below).

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,
                "custom": {
                    "my-property" : "my_value"
                }
            }
)

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
properties Optional[Dict[str, Any]]

See update_properties_of_tasks(...)

required