Design Point Service

Ansys DCS includes Ansys Design Point Service (DPS), which is the main service for storing and evaluating thousands of design points using multiple heterogeneous compute resources.

The DPS Python client wraps around the DPS service REST API available at https://hostname/dcs/dps/api.

Connection module

ansys.dcs.client.connection.create_session(access_token=None)

Return a requests.Session object configured for DPS with given access token

Parameters:

access_token (str) – The access token provided by ansys.dcs.client.auth.authenticate()

Returns:

The session object.

Return type:

requests.Session

ansys.dcs.client.connection.ping(session, url, timeout=10.0)

Ping the given URL, returning true on success

Parameters:
  • session – The requests.Session object.

  • url (str) – The URL address to ping.

Returns:

True on success.

Return type:

bool

Client object

class ansys.dcs.client.dps.Client(dcs_url='https://127.0.0.1/dcs', username=None, password=None, refresh_token=None, access_token=None, auth_api_url=None)

A python interface to the Design Point Service API.

Uses the provided credentials to create and store an authorized requests.Session object.

The following authentication workflows are supported:

  • Username and password: the client connects to the OAuth server and requests access and refresh tokens.

  • Refresh token: the client connects to the OAuth server and requests a new access token.

  • Access token: no authentication needed.

Parameters:
  • dcs_url (str) – The base path for the server to call, e.g. “https://127.0.0.1/dcs”.

  • username (str) – Username (Optional)

  • password (str) – Password (Optional)

  • refresh_token (str) – Refresh Token (Optional)

  • access_token (str) – Access Token (Optional)

Example

>>> from ansys.dcs.client.dps import Client
>>> # Create client object and connect to DCS with username & password
>>> cl = Client(dcs_url="https://127.0.0.1/dcs", username="dcadmin", password="dcadmin")
>>> # Extract refresh token to eventually store it
>>> refresh_token = cl.refresh_token
>>> # Alternative: Create client object and connect to DCS with refresh token
>>> cl = Client(dcs_url="https://127.0.0.1/dcs", refresh_token=refresh_token)
archive_project(project, path, include_design_point_files=True)

Archive an existing project and save it to disk

Parameters:
  • project (ansys.dcs.client.dps.Project) – A Project object (only the id field is needed).

  • path (str) – Where to save the archive locally.

  • include_design_point_files (bool, optional) – Whether to include design point files in the archive. True by default.

Returns:

The path to the archive.

Return type:

str

copy_project(project, project_target_id)

Copy an existing project

create_project(project, replace=False, as_objects=True)

Create a new project

create_task_definition_templates(templates)

Create new task definition templates

Parameters:

templates (list of ansys.dcs.client.dps.TaskDefinitionTemplate) – A list of task definition templates

delete_project(project)

Delete a project

delete_task_definition_templates(templates)

Delete existing task definition templates

Parameters:

templates (list of ansys.dcs.client.dps.TaskDefinitionTemplate) – A list of task definition templates

get_api_info()

Return info like version, build date etc of the DPS API the client is connected to

get_evaluators(as_objects=True, **query_params)

Return a list of evaluators, optionally filtered by given query parameters

get_project(id)

Return a single project for given project id

get_projects(**query_params)

Return a list of projects, optionally filtered by given query parameters

get_task_definition_templates(as_objects=True, **query_params)

Return a list of task definition templates, optionally filtered by given query parameters

refresh_access_token()

Use the refresh token to obtain a new access token

restore_project(path, project_id)

Restore a project from an archive

Parameters:
  • path (str) – Path of the archive file to be restored.

  • project_id (str) – ID of the restored project.

Returns:

A Project object.

Return type:

ansys.dcs.client.dps.Project

update_evaluators(evaluators, as_objects=True)

Update evaluators configuration

update_project(project, as_objects=True)

Update an existing project

update_task_definition_templates(templates)

Update existing task definition templates

Parameters:

templates (list of ansys.dcs.client.dps.TaskDefinitionTemplate) – A list of task definition templates

File

class ansys.dcs.client.dps.File(project=None, src=None, **kwargs)

File resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A project resource. Defaults to None.

  • src (str, optional) – Path to the local file. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the File schema below.

Example

>>> # input file
>>> f1 = File(name="mac", evaluation_path="demo_project.mac",
                type="text/plain", src=os.path.join(os.getcwd(), "motorbike_frame.mac")
>>> # output file
>>> f2 = File(name="img", evaluation_path="file000.jpg", type="image/jpeg") )

The File schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the file resource.

type

string

Type of the file. This can be any string but using a correct media type for the given resource is advisable.

storage_id

string

File’s identifier in the (orthogonal) file storage system

size

integer

hash

string

creation_time

string

The date and time the file resource was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the file resource was last modified.

  • It must be formatted as date-time

format

string

evaluation_path

string

Relative path under which the file instance for a design point evaluation will be stored.

monitor

boolean

Whether to live monitor the file’s content.

collect

boolean

Whether file should be collected per design point

collect_interval

integer

Collect frequency for a file with collect=True. Min value limited by the evaluator’s settings. 0/None - let the evaluator decide, other value - interval in seconds

reference_id

integer

Reference file from which this one was created

download(target_path, stream=True, progress_handler=None)

Download file content and save it to disk. If stream=True, data is retrieved in chunks, avoiding storing the entire content in memory.

Project

class ansys.dcs.client.dps.Project(client=None, **kwargs)

Project resource

Parameters:
  • client (ansys.dcs.client.dps.Client, optional) – A client object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the Project schema below.

Example

>>> proj = Project(id="demo_project", active=True, priority=10)
>>> proj = client.create_project(proj, replace=True)

The Project schema has the following fields:

Name

Type

Description

Validations

id

string

Unique ID to access the project, specified on creation of the project.

display_name

string

Name of the project.

active

boolean

Defines whether the project is active for evaluation.

priority

integer

Priority to pick the project for evaluation.

creation_time

string

The date and time the project was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the project was last modified.

  • It must be formatted as date-time

file_storages[]

array

List of file storages defined for the project.

statistics

object

Optional dictionary containing various project statistics.

copy(project_id)

Create a copy of the project

Parameters:

project_id (str) – ID of the new project.

copy_design_points(design_points, as_objects=True)

Create new design points by copying existing ones

Parameters:

design_points (list of ansys.dcs.client.dps.DesignPoint) – A list of design point objects

Note that only the id field of the design point objects need to be filled; the other fields can be empty.

create_algorithms(algorithms, as_objects=True)
create_configurations(configurations, as_objects=True)
create_design_points(design_points, as_objects=True)

Create new design points

Parameters:
  • design_points (list of ansys.dcs.client.dps.DesignPoint) – A list of design point objects

  • as_objects (bool) – Whether to return design points as objects or dictionaries

Returns:

List of ansys.dcs.client.dps.DesignPoint or list of dict if as_objects is False

create_files(files, as_objects=True)
create_license_contexts(as_objects=True)
create_selections(selections, as_objects=True)
delete_algorithms(algorithms)
delete_configurations(configurations)
delete_design_points(design_points)

Delete existing design points

Parameters:

design_points (list of ansys.dcs.client.dps.DesignPoint) – A list of design point objects

Note that only the id field of the design point objects need to be filled; the other fields can be empty.

Example

>>> dps_to_delete = []
>>> for id in [1,2,39,44]:
>>>    dps_to_delete.append(DesignPoint(id=id))
>>> project.delete_design_points(dps_to_delete)
delete_files(files)
delete_license_contexts()
delete_selections(selections)
property fs_bucket_url

URL of the project’s bucket in the file storage gateway

property fs_url

URL of the file storage gateway

get_algorithms(as_objects=True, **query_params)
get_configurations(as_objects=True, **query_params)
get_design_points(as_objects=True, **query_params)
get_files(as_objects=True, content=False, **query_params)

Return a list of file resources, optionally filtered by given query parameters. If content=True, each files content is downloaded as well and stored in memory as ansys.dcs.client.dps.File.content.

get_license_contexts(as_objects=True, **query_params)
get_permissions(as_objects=True)
get_selections(as_objects=True, **query_params)
get_tasks(as_objects=True, **query_params)
update_algorithms(algorithms, as_objects=True)
update_configurations(configurations, as_objects=True)
update_design_points(design_points, as_objects=True)

Update existing design points

Parameters:
  • design_points (list of ansys.dcs.client.dps.DesignPoint) – A list of design point objects

  • as_objects (bool) – Whether to return design points as objects or dictionaries

Returns:

List of ansys.dcs.client.dps.DesignPoint or list of dict if as_objects is True

update_files(files, as_objects=True)
update_license_contexts(license_contexts, as_objects=True)
update_permissions(permissions)
update_selections(selections, as_objects=True)
update_tasks(tasks, as_objects=True)

Fitness Definition

class ansys.dcs.client.dps.FitnessTermDefinition(**kwargs)

FitnessTermDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the FitnessTermDefinition schema below.

The FitnessTermDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the fitness term.

expression

string

The Python expression that defines the fitness term.

type

string

Fitness term type.

  • It must be equal to one of the elements in [“design_objective”, “limit_constraint”, “target_constraint”]

weighting_factor

number

Relative importance of the fitness term in comparison to other fitness terms.

Example

>>> # A fitness term of type objective
>>> ft1 = FitnessTermDefinition(name="weight", type="design_objective", weighting_factor=1.0,
                expression="map_design_objective( values['weight'], 7.5, 5.5)")
>>> # A fitness term of type target constraint
>>> ft2 = FitnessTermDefinition(name="torsional_stiffness", type="target_constraint", weighting_factor=0.8,
            expression="map_target_constraint( values['torsion_stiffness'], 1313.0, 5.0, 30.0 )" )
>>> # A fitness term of type limit constraint
>>> ft3 = FitnessTermDefinition(name="max_stress", type="limit_constraint", weighting_factor=0.6,
            expression="map_limit_constraint( values['max_stress'], 451.0, 50.0 )")
class ansys.dcs.client.dps.FitnessDefinition(**kwargs)

FitnessDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the DesignPoint schema below.

Example

>>> fd = FitnessDefinition(error_fitness=10.0)
>>> fd.add_fitness_term(name="weight", type="design_objective", weighting_factor=1.0,
            expression="map_design_objective( values['weight'], 7.5, 5.5)")
>>> fd.add_fitness_term(name="torsional_stiffness", type="target_constraint", weighting_factor=1.0,
            expression="map_target_constraint( values['torsion_stiffness'], 1313.0, 5.0, 30.0 )" )

The FitnessDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

fitness_term_definitions[]

array

List of ansys.dcs.client.dps.FitnessTermDefinition.

error_fitness

number

The default fitness value assigned to failed design points.

add_fitness_term(**kwargs)

Helper function to easily add a fitness term

Parameters

class ansys.dcs.client.dps.FloatParameterDefinition(**kwargs)

FloatParameterDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the FloatParameterDefinition schema below.

Example

>>> # A continuos parameter
>>> pd1 = FloatParameterDefinition(name='param_1', lower_limit=4.0, upper_limit=20.0, default=12.0 )
>>> # In case of e.g. a manifacturing variable which can only take some values
>>> pd2 = FloatParameterDefinition(name='param_2', value_list=[4.7, 12.0, 15.5, 20.0], default=12.0)

The FloatParameterDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name (ID) of the parameter.

quantity_name

string

Name of the quantity the parameter represents, e.g. Length.

units

string

Units for the parameter.

display_text

string

Text to display as the parameter name.

mode

string

Indicates whether it’s an input or output parameter. Filled server side.

default

number

Default parameter value.

lower_limit

number

Lower bound for the parameter value.

upper_limit

number

Upper bound for the parameter value.

step

number

If provided, allowable values are given by: AllowableValue = lower_limit + n * step, where n is an integer and AllowableValue <= upper_limit.

cyclic

boolean

Indicates if the parameter is cyclic.

value_list[]

array

A list of allowed values, alternative to providing upper and lower limits.

class ansys.dcs.client.dps.BoolParameterDefinition(**kwargs)

BoolParameterDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the BoolParameterDefinition schema below.

The BoolParameterDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name (ID) of the parameter.

quantity_name

string

Name of the quantity the parameter represents, e.g. Length.

units

string

Units for the parameter.

display_text

string

Text to display as the parameter name.

mode

string

Indicates whether it’s an input or output parameter. Filled server side.

default

boolean

Default parameter value.

class ansys.dcs.client.dps.IntParameterDefinition(**kwargs)

IntParameterDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the IntParameterDefinition schema below.

Example

>>> pd1 = IntParameterDefinition(name='ply_angle', value_list=[-60, -45, 0, 45, 60], default=0)
>>> pd2 = IntParameterDefinition(name='number_of_layers', lower_limit=1, upper_limit=5, default=2, step=1)

The IntParameterDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name (ID) of the parameter.

quantity_name

string

Name of the quantity the parameter represents, e.g. Length.

units

string

Units for the parameter.

display_text

string

Text to display as the parameter name.

mode

string

Indicates whether it’s an input or output parameter. Filled server side.

default

integer

Default parameter value.

lower_limit

integer

Lower bound for the parameter value.

upper_limit

integer

Upper bound for the parameter value.

step

integer

Equal to 1 by default.

cyclic

boolean

Indicates if the parameter is cyclic.

class ansys.dcs.client.dps.StringParameterDefinition(**kwargs)

StringParameterDefinition resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the StringParameterDefinition schema below.

Example

>>> pd = StringParameterDefinition(name='DiameterDistribution', value_list=['Constant', 'Uniform', 'Log-Normal'], default='Constant')

The StringParameterDefinition schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name (ID) of the parameter.

quantity_name

string

Name of the quantity the parameter represents, e.g. Length.

units

string

Units for the parameter.

display_text

string

Text to display as the parameter name.

mode

string

Indicates whether it’s an input or output parameter. Filled server side.

default

string

Default parameter value.

value_list[]

array

A list of allowed values.

class ansys.dcs.client.dps.ParameterLocation(**kwargs)

ParameterLocation resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the ParameterLocation schema below.

Example

>>> pl = ParameterLocation(key_string='radius(0)', tokenizer="=", parameter_definition_name="tube_radius")

The ParameterLocation schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

line

integer

column

integer

key_string

string

float_field

string

width

integer

precision

integer

tokenizer

string

decimal_symbol

string

digit_grouping_symbol

string

string_quote

string

true_string

string

false_string

string

parameter_definition_name

string

Name of the parameter this parameter location applies to.

process_step_property

string

file_id

integer

ID of the file resource.

Process Steps

class ansys.dcs.client.dps.SuccessCriteria(**kwargs)

SuccessCriteria resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the SuccessCriteria schema below.

Example

>>> sc = SuccessCriteria(
        return_code=0,
        expressions= ["values['tube1_radius']>=4.0", "values['tube1_thickness']>=0.5"],
        required_output_file_ids=[ f.id for f in files[2:] ],
        require_all_output_files=False,
        required_output_parameter_names=["weight", "torsion_stiffness", "max_stress"],
        require_all_output_parameters=False
    )

The SuccessCriteria schema has the following fields:

Name

Type

Description

Validations

return_code

integer

The process exit code that must be returned by the executed command.

expressions[]

array

A list of expressions to be evaluated.

required_output_file_ids[]

array

List of IDs of required output files.

require_all_output_files

boolean

Flag to require all output files.

required_output_parameter_names[]

array

List of names of required output parameters.

require_all_output_parameters

boolean

Flag to require all output parameters.

class ansys.dcs.client.dps.Licensing(**kwargs)

Licensing resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the Licensing schema below.

Example

>>> lic = Licensing(enable_shared_licensing=true)

The Licensing schema has the following fields:

Name

Type

Description

Validations

enable_shared_licensing

boolean

Whether to enable shared licensing contexts for Ansys simulations

class ansys.dcs.client.dps.ProcessStep(**kwargs)

ProcessStep resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the ProcessStep schema below.

Example

>>> ps = ProcessStep(
            name="MAPDL_run",
            application_name="ANSYS Mechanical APDL",
            application_version="20.1",
            execution_command="%executable% -b -i %file:mac% -o file.out -np %num_cores%",
            max_execution_time=20.0,
            cpu_core_usage=1,
            execution_level=0,
            memory=250,
            disk_space=5,
        )

The ProcessStep schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the process step.

application_name

string

Name of the application that executes the process step, e.g. ‘Ansys Workbench’.

application_version

string

Required application version, e.g. ‘20.1’.

application_capabilities[]

array

Optional specification of required application capabilities, e.g. [‘SCDM’].

execution_command

string

Command to execute the process step.

execution_level

integer

Defines when this process step is executed if a sequence with multiple process steps is defined.

max_execution_time

number

Maximum time in seconds for executing the process step.

memory

integer

Minimum amount of memory in MBs that is needed to execute the process step.

cpu_core_usage

number

Minimum number of processor cores needed to execute the process step.

disk_space

integer

Minimum amount of free disk space in MBs that is needed to execute the process step.

num_trials

integer

Maximum number of attempts to execute the process step.

store_output

boolean

Specify whether to store the standard output of the process step.

input_file_ids[]

array

List of IDs of input files.

output_file_ids[]

array

List of IDs of output files.

success_criteria

object

A ansys.dcs.client.dps.SuccessCriteria object.

licensing

object

A ansys.dcs.client.dps.Licensing object.

Configuration

class ansys.dcs.client.dps.Configuration(project=None, **kwargs)

Configuration resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A Project object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the Configuration schema below.

Example

>>> cfg = Configuration(name="Configuration.1", active=True)
>>> cfg.add_float_parameter_definition(name='tube_radius', lower_limit=4.0, upper_limit=20.0,default=12.0 )

The Configuration schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the configuration

active

boolean

Defines whether this is the active configuration in the project where evaluators will evaluate pending design points

creation_time

string

The date and time the configuration was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the configuration was last modified.

  • It must be formatted as date-time

parameter_definitions[]

array

List of parameter definitions, see e.g. ansys.dcs.client.dps.FloatParameterDefinition.

parameter_locations[]

array

List of ansys.dcs.client.dps.ParameterLocation.

process_steps[]

array

List of ansys.dcs.client.dps.ProcessStep.

fitness_definition

object

An ansys.dcs.client.dps.FitnessDefinition object.

add_bool_parameter_definition(**kwargs)

Helper function to easily add a bool parameter

add_float_parameter_definition(**kwargs)

Helper function to easily add a float parameter

add_int_parameter_definition(**kwargs)

Helper function to easily add an integer parameter

add_parameter_location(**kwargs)

Helper function to easily add a parameter location

add_process_step(**kwargs)

Helper function to easily add a process step

add_string_parameter_definition(**kwargs)

Helper function to easily add a string parameter

copy_design_points(design_points)
create_design_points(design_points)
delete_design_points(design_points)
get_design_points(**query_params)

Return a list of desing points, optionally filtered by given query parameters

Task

class ansys.dcs.client.dps.Task(project=None, **kwargs)

Task resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A Project object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the Task schema below.

The Task schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

last_modification_time

string

The date and time the task was last modified.

  • It must be formatted as date-time

creation_time

string

The date and time the task was created.

  • It must be formatted as date-time

pending_time

string

The date and time the task was set to pending.

  • It must be formatted as date-time

prolog_time

string

The date and time the task was set to prolog.

  • It must be formatted as date-time

running_time

string

The date and time the task was set to running.

  • It must be formatted as date-time

finished_time

string

The date and time the task was completed.

  • It must be formatted as date-time

eval_status

string

Evaluation status.

trial_number

integer

Which attempt to execute the process step this task represent.

elapsed_time

number

Number of seconds it took the evaluator to execute the task.

process_step_id

integer

ID of the ansys.dcs.client.dps.ProcessStep the task is linked to.

process_step_snapshot

object

Snapshot of ansys.dcs.client.dps.ProcessStep created when task status changes to prolog, before evaluation.

design_point_id

integer

ID of the ansys.dcs.client.dps.DesignPoint the task is linked to.

evaluator

string

UUID of the ansys.dcs.client.dps.Evaluator that updated the task.

input_file_ids[]

array

List of IDs of input files of task.

output_file_ids[]

array

List of IDs of output files of task.

inherited_file_ids[]

array

List of IDs of inherited files of task.

owned_file_ids[]

array

List of IDs of owned files of task.

Design Point

class ansys.dcs.client.dps.DesignPoint(project=None, **kwargs)

DesignPoint resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A Project object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the DesignPoint schema below.

Example

>>> dps = []
>>> dps.append( DesignPoint( name="dp_1", eval_status="pending") )
>>> dps.append( DesignPoint( name="dp_2", eval_status="pending") )
>>> project_configuration.create_design_points( dps )

The DesignPoint schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the design point.

eval_status

string

Evaluation status.

  • It must be equal to one of the elements in [“inactive”, “pending”, “prolog”, “running”, “evaluated”, “failed”, “aborted”, “timeout”]

configuration_id

integer

ID of the linked configuration, see ansys.dcs.client.dps.Configuration.

priority

integer

Priority with which design points are evaluated. The default is 0, which is the highest priority. Assigning a higher value to a design point makes it a lower priority.

values

object

Dictionary with (name,value) pairs for all parameters defined in the linked configuration.

fitness

number

Fitness value computed.

fitness_term_values

object

Dictionary with (name,value) pairs for all fitness terms computed.

note

string

Optional note for this design point.

creator

string

Optional name/ID of the creator of this design point.

executed_process_step_level

integer

Execution level of the last executed process step (-1 if none has been executed yet).

creation_time

string

The date and time the design point was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the design point was last modified.

  • It must be formatted as date-time

elapsed_time

number

Number of seconds it took the evaluator(s) to update the design point.

evaluators[]

array

List of UUID strings of the evaluators that updated the design point.

file_ids[]

array

List of IDs of all files of this design point.

get_tasks(as_objects=True, **query_params)

Return a list of tasks, optionally filtered by given query parameters

Parameters:
  • as_objects (bool, optional) – Defaults to True.

  • **query_params – Optional query parameters.

Returns:

List of ansys.dcs.client.dps.Task or list of dict if as_objects is False

update_tasks(tasks, as_objects=True, **query_params)

Update existing tasks

Parameters:
  • tasks (list of ansys.dcs.client.dps.Task) – A list of task objects

  • as_objects (bool) – Whether to return tasks as objects or dictionaries

Returns:

List of ansys.dcs.client.dps.Task or list of dict if as_objects is True

Design Point Selection

class ansys.dcs.client.dps.Selection(project=None, **kwargs)

Selection resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A Project object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the Selection schema below.

Example

>>> sel = Selection(name="selection_0", design_points=[1,2,15,28,45])

The Selection schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the selection.

creation_time

string

The date and time the selection was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the selection was last modified.

  • It must be formatted as date-time

algorithm_id

integer

ID of the ansys.dcs.client.dps.Algorithm the selection belongs to (optional).

design_points[]

array

List of design point IDs.

get_design_points(as_objects=True, **query_params)

Return a list of design points, optionally filtered by given query parameters

Returns:

List of ansys.dcs.client.dps.DesignPoint or list of dict if as_objects is True

Design Exploration Algorithm

class ansys.dcs.client.dps.Algorithm(project=None, **kwargs)

Algorithm resource.

Parameters:
  • project (ansys.dcs.client.dps.Project, optional) – A Project object. Defaults to None.

  • **kwargs – Arbitrary keyword arguments, see the Algorithm schema below.

Example

>>> algo = Algorithm(name="gradient_descent")
>>> algo.description = "Gradient descent is an iterative optimization algorithm."
>>> algo.data = "{"step_size": 0.2,"max_iterations":10}"

The Algorithm schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

name

string

Name of the algorithm.

description

string

Description of the algorithm.

creation_time

string

The date and time the algorithm was created.

  • It must be formatted as date-time

last_modification_time

string

The date and time the algorithm was last modified.

  • It must be formatted as date-time

data

string

Generic string field to hold arbitrary algorithm configuration data, e.g. as JSON dict​ionary.

design_points[]

array

List of design point IDs.

get_design_points(as_objects=True, **query_params)

Return a list of design points, optionally filtered by given query parameters

Returns:

List of ansys.dcs.client.dps.DesignPoint or list of dict if as_objects is False

get_selections(as_objects=True, **query_params)

Return a list of selections, optionally filtered by given query parameters

Returns:

List of ansys.dcs.client.dps.Selection or list of dict if as_objects is False

Evaluator

class ansys.dcs.client.dps.Evaluator(**kwargs)

Evaluator resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the Evaluator schema below.

The Evaluator schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

uuid

string

Unique identifier built from hardware information and selected configuration details of an evaluator.

name

string

Name of the evaluator.

hostname

string

Name of the host on which the evaluator is running.

platform

string

Operating system on which the evaluator is running.

task_manager_type

string

Type of the task manager used by the evaluator.

project_server_select

boolean

Whether the evaluator allows server-driven assignment of projects or uses it’s own local settings.

alive_update_interval

integer

Minimal time (in seconds) between evaluator registration updates.

update_time

string

Last time the evaluator updated it’s registration details. Used to check which evaluators are alive.

  • It must be formatted as date-time

external_access_port

integer

Port number for external access to the evaluator.

project_assignment_mode

string

Which strategy to use for selecting projects to work on.

  • It must be equal to one of the elements in [“disabled”, “all_active”, “project_list”]

project_list[]

array

List of projects on which this evaluator should be working.

configuration

object

Details of the evaluator configuration, including hardware info and available applications.

Task Definition Template

class ansys.dcs.client.dps.TaskDefinitionTemplate(**kwargs)

TaskDefinitionTemplate resource.

Parameters:

**kwargs – Arbitrary keyword arguments, see the TaskDefinitionTemplate schema below.

Example

>>> template = TaskDefinitionTemplate(
            name="MAPDL_run",
            application_name="ANSYS Mechanical APDL",
            application_version="2022 R2",
            data = {
                "execution_command": "%executable% -b -i %file:mac% -o file.out -np %num_cores%",
                "output_files": [
                    {
                      "name": "out",
                      "obj_type": "File",
                      "evaluation_path": "solve.out",
                      "type": "text/plain",
                      "collect": true,
                      "monitor": true
                    }
                ]
            }
        )

The TaskDefinitionTemplate schema has the following fields:

Name

Type

Description

Validations

id

integer

Unique ID to access the resource, generated internally by the server on creation.

last_modification_time

string

Last time the object was modified, in UTC

  • It must be formatted as date-time

creation_time

string

Time when the object was created, in UTC

  • It must be formatted as date-time

name

string

Name of the template

application_name

string

Name of the application to which the template applies

application_version

string

Version of the application to which the template applies

data

object

Template’s detailed data