Skip to content

Steps

Step

Step(
    id,
    iteration,
    name,
    index,
    slug,
    description=None,
    completed=None,
    artifacts=None,
    step_type=StepType.Step,
    text=None,
)

Model a Vectice step.

Steps define the logical sequence of steps required to complete the phase along with their expected outcomes.

Steps belong to an Iteration. The steps created under a Phase are Step Definitions that are then re-used in Iterations to iteratively complete the steps until a satisfactory result is obtained.

📁 phase 1
├── 📄 step definition 1
├── 📄 step definition 2
└── 📄 step definition 3
📁 iteration 1 of phase 1
├── 📄 step 1
├── 📄 step 2
└── 📄 step 3

If steps are added to a phase after iterations have been created and completed, these steps won't appear in these iterations.

Phases and Steps Definitions are created in the Vectice App, Iterations are created from the Vectice Python API.

To complete an iteration's step, you just need to assign a value to it. To access the step and assign a value, you can use the "slug" of the step: the slug is the name of the step, transformed to fit Python's naming rules, and prefixed with step_. For example, a step called "Clean Dataset" can be accessed with my_iteration.step_clean_dataset.

Therefore, to complete a step:

my_clean_dataset = ...
my_iteration.step_clean_dataset = my_clean_dataset

Depending on the step, you can assign it a Model, a Dataset, code source, or attachments.

Vectice users shouldn't need to instantiate Steps manually, but here are the step parameters.

Parameters:

Name Type Description Default
id int

The step identifier.

required
iteration Iteration

The iteration to which the step belongs.

required
name str

The name of the step.

required
index int

The index of the step.

required
slug str

The slug of the step.

required
description str | None

The description of the step.

None
completed bool | None

Deprecated. Whether the step is completed.

None
artifacts list[IterationStepArtifact] | None

The artifacts linked to the steps.

None
step_type StepType

The step type.

StepType.Step
text str | None

The step text.

None
Source code in src/vectice/models/step.py
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@deprecate(
    parameter="completed",
    warn_at="23.1",
    fail_at="23.2",
    remove_at="23.3",
    reason="The `completed` parameter is deprecated. "
    "Using `completed` will raise an error in v{fail_at}. "
    "The parameter will be removed in v{remove_at}.",
)
def __init__(
    self,
    id: int,
    iteration: Iteration,
    name: str,
    index: int,
    slug: str,
    description: str | None = None,
    completed: bool | None = None,
    artifacts: list[IterationStepArtifact] | None = None,
    step_type: StepType = StepType.Step,
    text: str | None = None,
):
    """Initialize a step.

    Vectice users shouldn't need to instantiate Steps manually,
    but here are the step parameters.

    Parameters:
        id: The step identifier.
        iteration: The iteration to which the step belongs.
        name: The name of the step.
        index: The index of the step.
        slug: The slug of the step.
        description: The description of the step.
        completed: Deprecated. Whether the step is completed.
        artifacts: The artifacts linked to the steps.
        step_type: The step type.
        text: The step text.
    """
    self._id = id
    self._iteration: Iteration = iteration
    self._name = name
    self._index = index
    self._description = description
    self._client = self._iteration._client
    self._completed = completed
    self._artifacts = artifacts or []
    self._slug = slug
    self._origin_dataset: Dataset | None = None
    self._clean_dataset: Dataset | None = None
    self._modeling_dataset: Dataset | None = None
    self._type: StepType = step_type
    self._text = text
    self._model: Model | None = None

    self._iteration_read_only = self._iteration._status in {IterationStatus.Completed, IterationStatus.Abandoned}
    if self._iteration_read_only:
        _logger.debug(f"Step {self.name}, iteration is {self._iteration._status.name} and is read-only!")

clean_dataset writable property

clean_dataset: Dataset | None

Deprecated. The step's cleaned dataset.

Deprecated.

Assign and retrieve datasets directly to/from steps instead.

Returns:

Type Description
Dataset | None

The step's cleaned dataset, or None.

completed property

completed: bool

Whether this step is completed.

Deprecated since 23.1:

Use Iteration.completed instead, or simply check that a step has a value / is not None.

To support previous Vectice versions (22.4), this property will return True if the step was previously marked as complete. For new Vectice versions (23.1+), and steps that haven't been marked as complete, this property returns whether the iteration is completed.

Returns:

Type Description
bool

Whether this step is completed.

connection property

connection: Connection

The connection to which this step belongs.

Returns:

Type Description
Connection

The connection to which this step belongs.

id writable property

id: int

The step's id.

Returns:

Type Description
int

The step's id.

index property

index: int

The step's index.

Returns:

Type Description
int

The step's index.

iteration property

iteration: Iteration

The iteration to which this step belongs.

Returns:

Type Description
Iteration

The iteration to which this step belongs.

model writable property

model: Model | None

The step's model.

Returns:

Type Description
Model | None

The step's model.

modeling_dataset writable property

modeling_dataset: Dataset | None

Deprecated. The step's modeling dataset.

Deprecated.

Assign and retrieve datasets directly to/from steps instead.

Returns:

Type Description
Dataset | None

The training set, the test set and the validation set if it exists.

name property

name: str

The step's name.

Returns:

Type Description
str

The step's name.

origin_dataset writable property

origin_dataset: Dataset | None

Deprecated. The step's origin dataset.

Deprecated.

Assign and retrieve datasets directly to/from steps instead.

Returns:

Type Description
Dataset | None

The origin dataset, or None if there is none.

phase property

phase: Phase

The phase to which this step belongs.

Returns:

Type Description
Phase

The phase to which this step belongs.

project property

project: Project

The project to which this step belongs.

Returns:

Type Description
Project

The project to which this step belongs.

properties property

properties: dict

The step's name, id, and index.

Returns:

Type Description
dict

A dictionary containing the name, id and index items.

slug property

slug: str

The step's slug.

Returns:

Type Description
str

The step's slug.

text property

text: str | None

The step's text.

A string that is stored in the step.

Returns:

Type Description
str | None

The step's text.

workspace property

workspace: Workspace

The workspace to which this step belongs.

Returns:

Type Description
Workspace

The workspace to which this step belongs.

close

close(message=None)

Deprecated. Close the current step, marking it completed.

Parameters:

Name Type Description Default
message str | None

The message to use when closing the step.

None
Source code in src/vectice/models/step.py
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
@deprecate(
    warn_at="23.1",
    fail_at="23.2",
    remove_at="23.3",
    reason="The 'close' method is deprecated. "
    "Using 'close' will raise an error in v{fail_at}. "
    "The method will be removed in v{remove_at}.",
)
def close(self, message: str | None = None):
    """Deprecated. Close the current step, marking it completed.

    Parameters:
        message: The message to use when closing the step.
    """
    self._client.close_step(self.id, message)
    _logger.info(f"'{self.name}' was successfully closed.")
    self._completed = True

next_step

next_step(message=None)

Deprecated. Advance to the next step.

Close the current step (mark it completed) and return the next step to complete if another open step exists. Otherwise return None.

Note that steps are not currently ordered, and so the concept of "next" is rather arbitrary.

Parameters:

Name Type Description Default
message str | None

The message to use when closing the current step.

None

Returns:

Type Description
Step | None

The next step.

Source code in src/vectice/models/step.py
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
@deprecate(
    warn_at="23.1",
    fail_at="23.2",
    remove_at="23.3",
    reason="The 'next_step' method is deprecated. "
    "Using 'next_step' will raise an error in v{fail_at}. "
    "The method will be removed in v{remove_at}.",
)
def next_step(self, message: str | None = None) -> Step | None:
    """Deprecated. Advance to the next step.

    Close the current step (mark it completed) and return the next
    step to complete if another open step exists. Otherwise return None.

    Note that steps are not currently ordered, and so the concept
    of "next" is rather arbitrary.

    Parameters:
        message: The message to use when closing the current step.

    Returns:
        The next step.
    """
    try:
        self.close(message)
    except VecticeException:
        _logger.warning("The step is closed!")
        return None
    steps_output = self._client.list_steps(self._iteration._phase.id, self._iteration.index)
    open_steps = sorted(
        [
            Step(item.id, self._iteration, item.name, item.index, item.slug, item.description)
            for item in steps_output
            if not item.completed
        ],
        key=lambda x: x.index,
    )
    if not open_steps:
        _logger.warning("There are no active steps.")
        return None
    next_step = open_steps[0]
    _logger.info(f"Next step : {repr(next_step)}")
    return next_step