hrntsm/Tunny

View on GitHub
Optuna/Dashboard/HumanInTheLoop/Python/running_trials_length.py

Summary

Maintainability
A
0 mins
Test Coverage
from optuna.study import Study
from optuna.trial import TrialState, FrozenTrial


def running_trials_length(study: Study) -> int:
    running_trials: list[FrozenTrial] = study.get_trials(
        deepcopy=False, states=(TrialState.RUNNING,)
    )

    return len(running_trials)