Skip to content

5.0.0 - Workflow Components

Choose a tag to compare

@goatrocks goatrocks released this 21 Mar 17:59
· 177 commits to master since this release
d221fce

5.0 deprecates the existing method of creating models and questionnaires and unifies them under the AddModelGroupComponent call. This release requires a minimum platform version of 5.0. It will not work with lower platform versions. Find out more about these new changes by checking the documentation on workflows and components here

In 5.0, a component is akin to a step in the workflow process that can be linked with other components in sequence. Now, CreateModelGroup and CreateQuestionnaire redirect to the new AddModelGroupComponent call and are marked deprecated, however both now require the additional parameter of workflow_id and after_component_id. These define the workflow to create the component in, and the workflow component that the new Model Group or Questionnaire should follow. Previously, the creation of a workflow was implicit with CreateModelGroup, but now it has to be explicitly created prior to creating a model group, either through the UI or by using CreateWorkflow(self, dataset_id: int, name: str). Users should migrate as soon as feasible to the new pattern as both CreateModelGroup and CreateQuestionnaire will be removed in a future release.

You can find the id of a component by querying for the Workflow and either iterating through the components list or by using component_by_type()or model_group_by_name() on the Workflow object.

Calling CreateModelGroup now looks something like this:

    after_component = airlines_workflow.component_by_type("INPUT_OCR_EXTRACTION")
    mg: ModelGroup  = client.call(
        CreateModelGroup(
            name=name,
            workflow_id=airlines_workflow.id,
            dataset_id=airlines_dataset.id,
            after_component_id=after_component.id,
            source_column_id=airlines_dataset.datacolumn_by_name("Text").id,
            labelset_id=airlines_dataset.labelset_by_name("Target_1").id,
        )
    )

Calling AddModelGroup looks like this:

after_component_id = new_workflow.component_by_type("INPUT_OCR_EXTRACTION").id
modelgroupreq = AddModelGroupComponent(
    name=workflow_name,
    dataset_id=dataset.id,
    after_component_id=after_component_id,
    source_column_id=dataset.datacolumn_by_name(datacolumn).id,
    labelset_column_id=dataset.labelset_by_name(labelset_name).id,
    workflow_id=new_workflow.id
)
workflow: Workflow = client.call(modelgroupreq)
# workflow has the model_group in a component.

AddModelGroupComponent does not have a wait parameter currently, users can define now they want to wait by doing something like:

model_group = updated_workflow.model_group_by_name("my_classification_model")
status = client.call(GetModelGroupSelectedModelStatus(id=model_group.id))
while status not in ["FAILED", "COMPLETE", "NOT_ENOUGH_DATA"]:
    status = client.call(GetModelGroupSelectedModelStatus(id=model_group.id))