Workflow Engine

Understand the RMS workflow engine and workflow jobs.

Overview

Intelligent Risk Platform manages long-running processes using a workflow engine. Rather than processing these jobs immediately, the platform adds them to a queue for processing.

Services that initiate a workflow job return a 202 ACCEPTED status code that specifies workflow ID number in the Location header. The 202 Accepted response enables the workflow engine to manage long running jobs asynchronously and accept requests for other processes without requiring that connections to persist until the process is completed.

Workflows

Workflow jobs initiated on the workflow engine are identified by a unique job ID. These jobs are identified by their job type.

Workflow job types

The following Risk Modeler API services initiate workflow jobs on the Intelligent Risk Platform workflow engine.

ALM_IMPORT
ANALYTICS_JOB
CALCULATE_NON_EXPOSURE_STORAGE_SIZE
CLEANUP
CLEANUP_ANALYSIS_DATA
CLEANUP_TENANT_DATA
COMMIT_ACCOUNT
CONVERT_ACCOUNT_CURRENCY
Convert currency by account
CONVERT_AGGREGATE_PORTFOLIO_CURRENCY
Convert currency by aggregate portfolio
CONVERT_CURRENCY_LOSS_POSTPROCESSOR
Convert currency by analysis result
CONVERT_EVENT_RATE_LOSS
Convert event loss rate
CONVERT_PORTFOLIO_CURRENCY
Convert currency by portfolio
CONVERT_RESULT_CURRENCY
CONVERT_TREATY_CURRENCY
Convert currency by treaty
COPY_ACCOUNT
Copy account
COPY_AGGREGATE_PORTFOLIO
Copy aggregate portfolio
COPY_PORTFOLIO
Copy portfolio
CREATE_EDM
Administer EDM
DATASTORE_OPERATION
DATA_BRIDGE_DATABASE_SYNC
DATA_BRIDGE_NOTIFICATION
DELETE_ACCOUNT
Delete account
DELETE_AGGREGATE_PORTFOLIO
Delete aggregate portfolio
DELETE_EDM
Delete EDM
DELETE_PORTFOLIO
Delete portfolio
DELETE_RDM
DEREGISTER_DATA_BRIDGE_EDM
Deregister EDM
DETACH_EDM
Delete EDM
DLM
DOMAIN_DATA_LOAD
DOWNLOAD_DETACH_EDM
DOWNLOAD_EDM
Administer EDM
DOWNLOAD_LOCATION_RESULTS
Export data modules
DOWNLOAD_RDM
Export data modules
DOWNLOAD_RESULTS
Export data modules
EDM_METRICS
EDM_UPDATE
ENABLE_TENANT_UDS_FEATURE
EPENGINE
EXPOSURE_MANAGEMENT
FINALIZE_ANALYSIS
GEOCODING
GROUPING
GROUPING_LOSS_POSTPROCESSOR
HAZARD
HD
HD_ALM
HD_ALM_GROUPING
HD_ENGINE
HD_GROUPING
HD_LOSS_POSTPROCESSOR
HD_TO_RDM
IMPORT
IMPORT_RDM
LOSS_POSTPROCESSOR_ENGINE
MAP_PERSPECTIVE
Map perspectives
PREPARE_EXPOSURE
PROCESS_RDM
REGISTER_DATA_BRIDGE_EDM
Register EDM
RENAME_ANALYSIS
Rename analysis
SIMULATE_LOSSES
Simulate losses
UPDATE_RESULTS_COUNT
UPLOAD_EDM
Upload EDMs
UPLOAD_RDM
Upload RDMs

Responses

HTTP 202 Responses

On submission, service returns a 202 Accepted status and a URI in the Location header that enables you to track the status of the job /({host}/v1/workflows/100000).

The 202 Accepted status indicates that the request has been added to the workflow engine queue for processing. It is indicates that the job is processing and has not completed.

The Location header of the response returns information about the job including its type, ID, and a URI for retrieving information about the status of the job.

HTTP STATUS 202 (Accepted)

{
    "task": {
        "href": "/api/company/job-management/jobs/2130040",
        "id": "2130040"
    }
}

Workflow management services

The Workflow APIs enable clients to manage and track workflow jobs and operations running on the Intelligent Risk Platform workflow engine.

User-defined workflows

The Start user-defined workflow service (POST /v1/workflows/) enables clients to define and initiate a user-defined workflows consisting of multiple sequenced operations. The user-defined workflow manages the both the sequencing of operations and the reporting of status of operations and workflow itself. All workflow job attributes are specified in the request body.

This service supports both account-level or portfolio-level workflows, as defined by the type attribute. The accountWorkflow job type supports two operations: geohaz, and process. The portfolioWorkflow job type supports three operations: geohaz, group, and process.

  • The geohaz operation geohazards the account or portfolio. For accountWorkflow jobs, the operation initiates an account-level GEOHAZ job. For details see Geohazard account (/v2/accounts/{accontId}/geohaz). For portfolioWorkflow jobs, the operation initiates a portfolio-level GEOHAZ job. For details see, (Geohazard portfolio /v2/portfolios/{PortfolioId}/geohaz).
  • The group operation creates an analysis group for portfolio analysis results. For details, see Create analysis group service (/v2/analysis-groups).
  • The process operation analyzes the account or portfolio. For accountWorkflow jobs, the operation analyzes the account. For details, see Analyze account (/v2/accounts/{accoutId}/process). For portfolioWorkflow jobs, the operation analyzes the portfolio. For details, see Analyze portfolio (/v2/portfolios/{id}/process).

The request body specifies a unique name for the workflow job, its type (AccountWorkflow or PortfolioWorkflow), and an array of operations that define the jobs that comprise the workflow :

{
  "type": "PortfolioWorkflow",
  "name": "Sample User Defined Workflow",
  "operations": [{
    "label": "Geohaz1_Job",
    "operation": "geohaz",
    "dependsOn": [],
    "input": { 
      "id":"5", # portfolio ID
      "datasource":"EDM_NAME",
      "layers":[
        {
          "name": "geocode",
          "type": "geocode",
          "engineType": "RL",
          "version": "18.1",
          "layerOptions": {
            "skipPrevGeocoded": false,
            "aggregateTriggerEnabled": "false",
            "geoLicenseType": "0"
            }
         },
         {
            "name": "earthquake",
            "type": "hazard",
            "engineType": "RL",
            "version": "18.1",
            "layerOptions": {
              "skipPrevHazard": false,
              "overrideUserDef": false
            }
         }
      ]
    }
  },
  {
    "label": "Dlm1",
    "exposureType": "portfolio",
    "operation": "process",
    "dependsOn": ["Geohaz1_Job"],
    "input": {
      "id": 5,                
      "edm": "EDM_NAME",
      "currency": {
       "code": "USD",
       "scheme": "RMS",
       "vintage": "RL18",
       "asOfDate": "2020-03-01"
      },
      "modelProfileId": 105,
      "outputProfileId": 1,
      "eventRateSchemeId": 189,
      "treaties": [],
      "treatiesName": [],
      "jobName": "test-User-Defined-Workflow",
      "globalAnalysisSettings": {
        "franchiseDeductible": false,
        "minLossThreshold": "1.00",
        "treatConstructionOccupancyAsUnknown": true,
        "numMaxLossEvent": 1
      }
    }
  }]
}
 

Each operation is identified by four attributes: label, operation, dependsOn, and input:

  • The label attribute uniquely identifies the operation within the workflow. Operations are identified by label value in the in the dependsOn array.
  • The operation attribute identifies the operation type. Account workflow jobs support geohaz and process operations. Portfolio workflow jobs support geohaz, group, and process operations.
  • The dependsOn attribute specifies (by label value) an array of operations to be run before the current operation. Using the dependsOn attribute you can specify the order that operations are executed within a user-defined workflow job. For example, executing a geohaz operation before a process operation, and one or more process operations before a group operation.
  • The input attribute specifies operation-type specific data needed to perform the specified operation. The content of the input attribute corresponds to the content of the Geohazard account /Geohazard portfolio, Create analysis group , or Analyze account / Analyze portfolio services depending on the operation.

Get workflow and operation status

The Get workflow or operation service enables you to retrieve information about workflow jobs or operations including the status of the workflow.

  • A workflow job is a process that runs on the workflow engine.
  • An operation is a subprocess that runs within a user-defined workflow. Account workflow jobs support geohaz and process operations. Portfolio workflow jobs support geohaz, group, and process operations.

To retrieve information about a workflow job, specify the workflow ID in the endpoint:

curl --request GET \
     --url 'https://{host}/riskmodeler/v1/workflows/5673' \
     --header 'Accept: application/json' \
     --header 'Authorization: XXXXXXXXXX'

To retrieve information about an operation, specify the ID of an operation as a path parameter and the ID of the parent workflow using the parent query parameter:

curl --request GET \
     --url 'https://{host}/riskmodeler/v1/workflows/5673?parent=89993' \
     --header 'Accept: application/json' \
     --header 'Authorization: XXXXXXXXXX'

If a parent workflowId is specified as a query parameter, the id path parameter identifies the requestId of an operation within that workflow.

The response body returns information about the operation in the jobs array:

{
  "userName": "[email protected]",
  "status": "FINISHED",
  "name": "Create Group: New Group from Batch",
  "type": "GROUPING",
  "jobs": [
     {
     "id": "caece2d3-0854-402c-9428-336be01f54c0",
     "status": "Succeeded",
     "name": "GROUPING",
     "input": {
     },
     "output": {
       "groupName": "New Group from Batch",
       "groupDescription": "",
       "analysisId": "68977",
       "currency": "USD",
       "regionPerils": "NAEQ"
       },
       "percentComplete": 100
     }
  ],
  "summary": {
    "analysisId": "68977",
    "groupName": "New Group from Batch",
    "groupDescription": "",
    "regionPerils": "NAEQ",
    "currency": "USD"
  },
  "progress": 100,
  "messages": []
}

A successful response returns the Workflow object, which provides detailed information about this workflow job including the submitTime, startTime, type, job details, and its status:

  • QUEUED
  • RUNNING
  • FINISHED
  • FAILED
  • CANCELLED
  • PENDING
  • CANCELLING
  • CANCEL_REQUESTED

Did this page help you?