oasislmf.computation.run.platform

Classes

PlatformBase

Base platform class to handle opening a client connection

PlatformServerInfo

Print version/info details of the connected Oasis Platform API server

PlatformList

Return status and details from an Oasis Platform API server

PlatformRun

End to End - run model via the Oasis Platform API

PlatformDelete

Delete either a 'model', 'portfolio' or an 'analysis' from the API's Database

PlatformGet

Download file(s) from the api

PlatformPost

Upload file(s) to the api

PlatformValidate

Validate a portfolio's OED exposure files via the Oasis Platform API

PlatformExposureRun

Run oasislmf exposure run on the server against a portfolio's exposure files

PlatformExposureTransform

Convert a portfolio's exposure data between OED and AIR via the Oasis Platform API

PlatformCombine

Combine the ORD output of multiple RUN_COMPLETED analyses via the Oasis Platform API

PlatformCancel

Cancel a running analysis (input generation or execution) via the Oasis Platform API

PlatformSubTasks

List the sub-tasks of an analysis run via the Oasis Platform API

PlatformPlot

Plot a Gantt chart of an analysis's sub-tasks, with a status summary, via the Oasis Platform API

Module Contents

class oasislmf.computation.run.platform.PlatformBase(**kwargs)[source]

Bases: oasislmf.computation.base.ComputationStep

Base platform class to handle opening a client connection

step_params[source]
server[source]
load_credentials(login_arg, auth_type=None)[source]

Load credentials from JSON file or prompt interactively.

Options:

1.’–server-login ./APIcredentials.json’ 2. Load credentials from default config file ‘-C oasislmf.json’ 3. Interactive prompt (menu skipped when auth_type is already known)

try_connection(fail_safe=True, **kwargs)[source]

Helper to safely try connecting and return None if unauthorized.

open_connection()[source]

Attempts connection in this order: 1. API_EXAMPLE_AUTH username/password (skipped when auth_type is oidc or m2m) 2. API_EXAMPLE_AUTH client_id/client_secret (skipped when auth_type is simple) 3. Prompt or load credentials

tabulate_json(json_data, items)[source]
print_endpoint(attr, items)[source]
print_portfolios_summary(items)[source]

The portfolios list endpoint doesn’t include validation_status/ exposure_status - those are only present on the per-portfolio detail GET, so fetch each one individually to fill them in.

require_api_v2(feature_name)[source]

Guard for endpoints only available on the v2 (distributed) Platform API.

select_id(msg, valid_ids)[source]
pending_states = ['NONE', 'STARTED'][source]
poll_portfolio_field(portfolio_id, status_field, poll_interval, action_name)[source]

Poll a portfolio’s async status field (e.g. validation_status, exposure_status) until it settles on a terminal value.

A re-triggered run can end up back at the same terminal status it started at (e.g. RUN_COMPLETED -> STARTED -> RUN_COMPLETED), so completion can’t be detected by a status change alone - it must have passed through a pending state at least once since this run was triggered.

class oasislmf.computation.run.platform.PlatformServerInfo(**kwargs)[source]

Bases: PlatformBase

Print version/info details of the connected Oasis Platform API server

run()[source]
class oasislmf.computation.run.platform.PlatformList(**kwargs)[source]

Bases: PlatformBase

Return status and details from an Oasis Platform API server

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformRun(**kwargs)[source]

Bases: PlatformBase

End to End - run model via the Oasis Platform API

chained_commands[source]
run()[source]
class oasislmf.computation.run.platform.PlatformDelete(**kwargs)[source]

Bases: PlatformBase

Delete either a ‘model’, ‘portfolio’ or an ‘analysis’ from the API’s Database

step_params[source]
delete_list(attr, id_list)[source]
run()[source]
class oasislmf.computation.run.platform.PlatformGet(**kwargs)[source]

Bases: PlatformBase

Download file(s) from the api

step_params[source]
extract_args(param_suffix)[source]
download(collection, req_files, chuck_size=1024)[source]
run()[source]
class oasislmf.computation.run.platform.PlatformPost(**kwargs)[source]

Bases: PlatformBase

Upload file(s) to the api

Portfolio files are uploaded to a single portfolio per invocation - give –portfolio-id to update an existing portfolio, or omit it (optionally with –portfolio-name) to create a new one.

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformValidate(**kwargs)[source]

Bases: PlatformBase

Validate a portfolio’s OED exposure files via the Oasis Platform API

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformExposureRun(**kwargs)[source]

Bases: PlatformBase

Run oasislmf exposure run on the server against a portfolio’s exposure files

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformExposureTransform(**kwargs)[source]

Bases: PlatformBase

Convert a portfolio’s exposure data between OED and AIR via the Oasis Platform API

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformCombine(**kwargs)[source]

Bases: PlatformBase

Combine the ORD output of multiple RUN_COMPLETED analyses via the Oasis Platform API

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformCancel(**kwargs)[source]

Bases: PlatformBase

Cancel a running analysis (input generation or execution) via the Oasis Platform API

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformSubTasks(**kwargs)[source]

Bases: PlatformBase

List the sub-tasks of an analysis run via the Oasis Platform API

step_params[source]
run()[source]
class oasislmf.computation.run.platform.PlatformPlot(**kwargs)[source]

Bases: PlatformBase

Plot a Gantt chart of an analysis’s sub-tasks, with a status summary, via the Oasis Platform API

step_params[source]
STATUS_COLORS[source]
STATUS_ORDER = ['COMPLETED', 'STARTED', 'QUEUED', 'PENDING', 'ERROR', 'CANCELLED'][source]
LEGACY_OUTPUT_LABELS[source]
ORD_OUTPUT_LABELS[source]
run()[source]