Execution
aica_challenge_1.execution_structures.RunSpecification
dataclass
¶
A specification of a run to be executed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
A unique id of the run. It is autogenerated. |
required |
name
|
str
|
A name of the run. Must be unique, or the original gets overwritten. |
''
|
description
|
str
|
A description of the run. |
''
|
agent_name
|
str
|
A name of the agent that should participate in the run. It must be the agent's name, not a package name. |
''
|
scenario
|
str
|
A name of the scenario for the run. By default, it is 'Random' |
'Random'
|
variant
|
int
|
An identifier of the scenario variant. By default, it is '-1', which means random. |
-1
|
max_time
|
int
|
A maximum number of virtual seconds that can elapse before the run is terminated. |
100
|
max_actions
|
int
|
A maximum number of actions from one agent before the run is terminated. |
100
|
max_episodes
|
int
|
A number of episodes that should be executed. If the scenario or variant are random, they will be randomly selected for each episode. |
100
|
max_parallel
|
int
|
A maximum number of episodes running in parallel. Ignored if executed with the single_process flag. |
1
|
parameters
|
Dict[str, str]
|
Other, user or system-specified parameters. |
dict()
|
aica_challenge_1.execution_structures.RunStatus
¶
A status of a run or episode.
:INIT: An initial status before the execution.
:RUNNING: A run or episode is being executed.
:FINISHED: A run or episode successfully finished.
:ERROR: There was an error executing the run or episode.
aica_challenge_1.execution_structures.Episode
dataclass
¶
A class tracking one episode of a run. You should never directly create this class instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cyst_run_id
|
str
|
A CYST run ID for the episode. |
required |
stdout
|
str
|
A copy of stdout contents. |
required |
stderr
|
str
|
A copy of stderr contents. |
required |
run
|
int
|
An ID of a run this episode belongs to. |
-1
|
variant
|
int
|
An identifier of episode variant. |
-1
|
number
|
int
|
A sequence number of episode within a run. |
-1
|
status
|
RunStatus
|
A status of the episode. |
RUNNING
|
aica_challenge_1.execution_structures.Run
dataclass
¶
A class tracking a run. You should never directly create this class instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specification
|
RunSpecification
|
A run specification of the run. |
required |
executor
|
Optional[ProcessPoolExecutor]
|
A process pool that is used to execute the episodes. |
None
|
status
|
RunStatus
|
A status of the run. |
INIT
|
detail
|
str
|
Supplementary information for the run, usually error messages. |
''
|
running
|
Set[int]
|
A set of IDs of episodes that are currently running. |
set()
|
successful
|
Set[int]
|
A set of IDs of episodes that successfully finished. |
set()
|
error
|
Set[int]
|
A set of IDs of episodes that encountered an error. |
set()
|
episodes
|
Dict[int, Episode]
|
All episodes within the run. |
dict()
|
id
|
int
|
An ID of a run. Should be unique for the challenge instance. |
-1
|
aica_challenge_1.execution_manager.ExecutionManager
¶
The execution manager retrieves run specifications and takes care of run executions.
list_run_specifications() -> List[str]
¶
Provides a list of run names that are available for execution.
Returns:
| Type | Description |
|---|---|
List[str]
|
A list of run names. |
get_run_specification(name: str) -> Optional[RunSpecification]
¶
Attempts to retrieve a run specification by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A name of the specification. |
required |
Returns:
| Type | Description |
|---|---|
Optional[RunSpecification]
|
A run specification if it exists for a given name, or None otherwise. |
get_run(run_id: int) -> Run
¶
Gets the information about a specific run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
int
|
An ID of the run to get. |
required |
Returns:
| Type | Description |
|---|---|
Run
|
A run information. |
get_runs() -> List[Tuple[int, RunStatus]]
¶
Gets the IDs and statuses of all runs executed in the challenge instance.
Returns:
| Type | Description |
|---|---|
List[Tuple[int, RunStatus]]
|
Tuple containing the ID [0] and status [1] for each run. |
execute(specification: RunSpecification | str, single_process=False) -> None
¶
Executes a run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specification
|
RunSpecification | str
|
Either a RunSpecification object or a name of a run specification that is stored in the database. |
required |
single_process
|
If set to True, it will execute only one run at a time (regardless of the run specification) and it will display the stdout and stderr. If set to False, it will execute each run in a new process (even if the run specification says no parallel runs) and stdout and stderr are hidden and stored in the database. |
False
|