SHOP API
cognite.powerops.client.shop.shop_run_api.SHOPRunAPI.retrieve(external_id, ignore_unknown_ids=True)
Retrieve a SHOP run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
external_id
|
str | Sequence[str]
|
The external id(s) of the SHOP run(s) to retrieve. |
required |
ignore_unknown_ids
|
bool
|
Whether to ignore unknown ids or raise an error. |
True
|
Returns:
Type | Description |
---|---|
SHOPRun | SHOPRunList | None
|
The SHOP run(s). None if it is a single external id, and it is not found. |
Source code in cognite/powerops/client/shop/shop_run_api.py
cognite.powerops.client.shop.shop_run_api.SHOPRunAPI.retrieve_latest(watercourse=None, source=None, start_after=None, start_before=None, end_after=None, end_before=None, latest_by='last_updated_time')
Retrieves the the latest shop run given the filters.
Args:
watercourse: The watercourse(s) to filter on.
source: The source(s) to filter on.
start_after: The start time after which the SHOP run must have started.
start_before: The start time before which the SHOP run must have started.
end_after: The end time after which the SHOP run must have ended.
end_before: The end time before which the SHOP run must have ended.
latest_by: The property to retrieve by . The most reliable is last_updated_time
and created_time
.
Returns:
The most recent SHOP run, None if nothing matched the filter
Source code in cognite/powerops/client/shop/shop_run_api.py
cognite.powerops.client.shop.shop_run_api.SHOPRunAPI.list(watercourse=None, source=None, start_after=None, start_before=None, end_after=None, end_before=None, limit=DEFAULT_READ_LIMIT)
List the filtered SHOP runs.
Provide time stamps strings as YYYY-MM-DD) or otherwise something parsable by arrow.get()
can parse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
watercourse
|
str | list[str] | None
|
The watercourse(s) to filter on. |
None
|
source
|
str | list[str] | None
|
The source(s) to filter on. WARNING: Most |
None
|
start_after
|
str | Arrow | datetime | None
|
The start time after which the SHOP run must have started. |
None
|
start_before
|
str | Arrow | datetime | None
|
The start time before which the SHOP run must have started. |
None
|
end_after
|
str | Arrow | datetime | None
|
The end time after which the SHOP run must have ended. |
None
|
end_before
|
str | Arrow | datetime | None
|
The end time before which the SHOP run must have ended. |
None
|
limit
|
int
|
The maximum number of SHOP runs to return. |
DEFAULT_READ_LIMIT
|
Returns:
Type | Description |
---|---|
SHOPRunList
|
A list of SHOP runs. |
Source code in cognite/powerops/client/shop/shop_run_api.py
cognite.powerops.client.shop.shop_run_api.SHOPRunAPI.trigger_single_casefile(case, source=None, shop_run_external_id=None)
Trigger SHOP for a given case file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
case
|
SHOPCase
|
SHOPCase instance, contains data for the main case file and references to additional SHOP input files. |
required |
source
|
str | None
|
The source of the SHOP trigger. If nothing is passed, the method will try to detect the service principal of the current user. |
None
|
shop_run_external_id
|
str | None
|
External ID for the SHOP run event, must be unique within the CDF project. If nothing is passed, a new external ID will be generated. |
None
|
Returns:
Type | Description |
---|---|
SHOPRun
|
The new SHOP run created. |
Source code in cognite/powerops/client/shop/shop_run_api.py
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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
cognite.powerops.client.shop.shop_run_api.SHOPRunAPI.trigger_case(case, shop_version)
Trigger a collection of shop runs related to one Case (also referred to as watercourse). For each SHOPCase the prerun file will be used to trigger a shop run event in cdf, and used to trigger the CogSHOP container. Prerun files must exist in CDF.