Skip to content

get_scenarios() function

Retrieve a list of existing scenarios filtered by cycle or tag.

This function allows you to retrieve a list of scenarios based on optional filtering criteria. If both a cycle and a tag are provided, the returned list contains scenarios that belong to the specified cycle and also have the specified tag.

Parameters:

Name Type Description Default

cycle

Optional[Cycle]

The optional Cycle to filter scenarios by.

None

tag

Optional[str]

The optional tag to filter scenarios by.

None

is_sorted

bool

If True, sort the output list of scenarios using the sorting key. The default value is False.

False

descending

bool

If True, sort the output list of scenarios in descending order. The default value is False.

False

created_start_time

Optional[datetime]

The optional inclusive start date to filter scenarios by creation date.

None

created_end_time

Optional[datetime]

The optional exclusive end date to filter scenarios by creation date.

None

sort_key

Literal['name', 'id', 'creation_date', 'tags']

The optional sort_key to decide upon what key scenarios are sorted. The sorting is in increasing order for dates, in alphabetical order for name and id, and in lexicographical order for tags. The default value is "name".
If an incorrect sorting key is provided, the scenarios are sorted by name.

'name'

Returns:

Type Description
List[Scenario]

The list of scenarios filtered by cycle or tag.