Skip to main content
Version: 14

viktor.external.external_program

ExternalProgram

class viktor.external.external_program.ExternalProgram(queue_name, version)

Bases: ABC

Warning

Do not use this class directly in an application!

Base-class of an external analysis.

Parameters:
  • queue_name (str) – Name of the external integration.

  • version (int) – Version of the API between SDK <-> worker.

execute(timeout=25)

Run method to start an external analysis using a VIKTOR worker.

Note

This method needs to be mocked in (automated) unit and integration tests.

Parameters:

timeout (int) – Timeout period in seconds.

Raises:
  • TimeoutError when timeout has been exceeded

  • ConnectionError if no worker installed or connected

  • LicenseError if no license is available

  • ExecutionError if the external program cannot execute with the provided inputs

Return type:

None

OAuth2Integration

class viktor.external.external_program.OAuth2Integration(name)

New in 14.23.0

Third-party OAuth 2.0 integration.

Usage:

integration = vkt.external.OAuth2Integration('my-oauth2-integration')
access_token = integration.get_access_token()
# use access_token to do request on host URL associated with integration 'my-oauth2-integration'
get_access_token()

Obtain the personal access token

Raises:
  • PermissionDeniedError: needs login from user

  • ResourceNotFoundError: integration not found

  • PreconditionFailedError: integration not assigned to this app

Return type:

str