def METHOD_NAME(self, step: Step) -> None:
    # We don't do anything with uncacheable steps.
    if not step.cache_results:
        return
    # Get local file lock + remote dataset lock.
    lock = self._remote_lock(step)
    lock.acquire()
    self.locks[step] = lock
    step_info = self.step_info(step)
    if step_info.state == StepState.RUNNING:
        # Since we've acquired the step lock we know this step can't be running
        # elsewhere. But the step state can still say its running if the last
        warnings.warn(
            f"Step info for step '{step.unique_id}' is invalid - says step is running "
            "although it shouldn't be. Ignoring and overwriting step start time.",
            UserWarning,
        )
    elif step_info.state not in {StepState.INCOMPLETE, StepState.FAILED, StepState.UNCACHEABLE}:
        self.locks.pop(step).release()
        raise StepStateError(
            step,
            step_info.state,
            context=f"If you are certain the step is not running somewhere else, delete the step "
            f"datasets at {self._step_location(step)}",
        )
    if step_info.state == StepState.FAILED:
        # Refresh the environment metadata since it might be out-of-date now.
        step_info.refresh()
    # Update StepInfo to mark as running.
    try:
        step_info.start_time = utc_now_datetime()
        step_info.end_time = None
        step_info.error = None
        step_info.result_location = None
        self._update_step_info(step_info)
    except:  # noqa: E722
        self.locks.pop(step).release()
        raise