Skip to main content

ModelCenter APIs 2025 R1

Interface ModelCenter::IJobManager

Last update: 16.07.2025

Definition: ModelCenter/src/ModelCenter.odl (line 3598)

Allows you to set up a matrix of runs and runs them in parallel or serial depending on the preferences mode.

Members

Properties

Property wasHalted

Definition: ModelCenter/src/ModelCenter.odl (line 1)

boolean ModelCenter::IJobManager::wasHalted

Return type: boolean

Public functions

Function addInput

void ModelCenter::IJobManager::addInput(BSTR name, BSTR label)

Adds an input to all runs in the Job Manager.

Parameters:

  • name: Variable name.
  • label: Variable label.

Parameters:

  • BSTR name
  • BSTR label

Return type: void

Function setInput

void ModelCenter::IJobManager::setInput(long run, BSTR name, BSTR value)

Sets the value for a specified input variable for a specified run.

Parameters:

  • run: Index of the run this is to apply to (0-based index).
  • name: Name of the specified variable.
  • value: Value for the specified variable to run for this specified run.

Parameters:

  • long run
  • BSTR name
  • BSTR value

Return type: void

Function addOutput

void ModelCenter::IJobManager::addOutput(BSTR name, BSTR label)

Adds an output to all runs in the Job Manager.

Parameters:

  • name: Variable name.
  • label: Variable label.

Parameters:

  • BSTR name
  • BSTR label

Return type: void

Function getValidateAll

boolean ModelCenter::IJobManager::getValidateAll()

Whether or not the Job Manager will validate everything.

Returns:

yes(TRUE) or no(FALSE).

Return type: boolean

Function setValidateAll

void ModelCenter::IJobManager::setValidateAll(boolean flag)

Sets whether or not the Job Manager will validate everything.

Parameters:

  • flag: yes(TRUE) or no(FALSE).

Parameters:

  • boolean flag

Return type: void

Function getNumRuns

long ModelCenter::IJobManager::getNumRuns()

Gets the number of runs currently in the job matrix.

Returns:

The number of runs.

Return type: long

Function setNumRuns

void ModelCenter::IJobManager::setNumRuns(long numRuns)

Sets the number of runs that will take place in this job matrix.

Parameters:

  • numRuns: Number of runs.

Parameters:

  • long numRuns

Return type: void

Function submit

void ModelCenter::IJobManager::submit(IDispatch *dataCollector, [optional]VARIANT description, [optional]VARIANT fireAndForget)

Causes the run matrix to begin.

Parameters:

  • dataCollector: IDispatch* to an IDataCollector object.
  • description: The type of trade study to be run.
  • fireAndForget: Flag for whether fire-n-forget is enabled

Parameters:

  • IDispatch * dataCollector
  • [optional] VARIANT description
  • [optional] VARIANT fireAndForget

Return type: void

Function waitForJobCompletion

void ModelCenter::IJobManager::waitForJobCompletion()

Waits until the current run matrix has completed before continuing.

Return type: void

Function addRerun

void ModelCenter::IJobManager::addRerun(long run)

The job manager may alternately be used to re-run runs out of an existing Data Collector or Data Explorer object. Simply call this function for each run which should be run. When using the Job Manager in this form, do not use addInput, addOutput, setInput or setNumRuns.

Parameters:

  • run: 0 based run number to add to the re-run list.

Parameters:

  • long run

Return type: void

Function halt

void ModelCenter::IJobManager::halt(boolean halt)

Halt the running job in the Job Manager.

Parameters:

  • halt: Whether to halt the job or not.

Parameters:

  • boolean halt

Return type: void

Function getNumInputs

long ModelCenter::IJobManager::getNumInputs()

Retrieve the number of inputs in the job.

Returns:

The number of inputs.

Return type: long

Function getNumOutputs

long ModelCenter::IJobManager::getNumOutputs()

Retrieve the number of outputs in the job.

Returns:

The number of outputs.

Return type: long

Function getInput

BSTR ModelCenter::IJobManager::getInput(long index)

Get the specified input.

Parameters:

  • index: The index of the input to fetch.

Returns:

The input.

Parameters:

  • long index

Return type: BSTR

Function getOutput

BSTR ModelCenter::IJobManager::getOutput(long index)

Get the specified output.

Parameters:

  • index: The index of the output to fetch.

Returns:

The output.

Parameters:

  • long index

Return type: BSTR

Function getInputLabel

BSTR ModelCenter::IJobManager::getInputLabel(long index)

Get the label of the specified input.

Parameters:

  • index: The index of the input to fetch.

Returns:

The label of the input.

Parameters:

  • long index

Return type: BSTR

Function getOutputLabel

BSTR ModelCenter::IJobManager::getOutputLabel(long index)

Get the label of the specified output.

Parameters:

  • index: The index of the output to fetch.

Returns:

The label of the output.

Parameters:

  • long index

Return type: BSTR

Function getNumThreads

long ModelCenter::IJobManager::getNumThreads()

Get the number of threads to use when running in parallel.

Returns:

The number of threads to use

Return type: long

Function getRunInParallel

boolean ModelCenter::IJobManager::getRunInParallel()

Determine whether or not to run the job in parallel.

Returns:

true if the job is to be ran in parallel false otherwise.

Return type: boolean

Function setNumThreads

void ModelCenter::IJobManager::setNumThreads(long numThreads)

Set the number of threads to use if the job is to be ran in parallel.

Parameters:

  • numThreads: the number of threads to use

Parameters:

  • long numThreads

Return type: void

Function setRunInParallel

void ModelCenter::IJobManager::setRunInParallel(boolean runInParallel)

Tell the job manager to run the job in parallel.

Parameters:

  • runInParallel: true if the job is to be ran in parallel, false otherwise

Parameters:

  • boolean runInParallel

Return type: void

Function enableCache

boolean ModelCenter::IJobManager::enableCache(boolean enable)

Method to tell the job manager to enable or disable using cache for submitted designs. If you disable the cache, runs may be purged from the cache lookup either immediately or after subsequent runs.

Parameters:

  • enable: true if run values could be get from cache, if false, all submitted runs are to be executed.

Returns:

Previous setting.

Parameters:

  • boolean enable

Return type: boolean

Function clearCache

void ModelCenter::IJobManager::clearCache()

Method to actively clear job manager's internal cache of executed runs.

Return type: void

Function getRunIndex

long ModelCenter::IJobManager::getRunIndex(VARIANT names, VARIANT values)

Method to get Run Index for the given design from cache. Only works if you've been running jobs with the run cache enabled.

Parameters:

  • names: array of variable names for the design
  • values: array of values corresponding to the names array

Returns:

index of design in data explorer if design found else -1

Parameters:

  • VARIANT names
  • VARIANT values

Return type: long

Function resume

void ModelCenter::IJobManager::resume(IDispatch *dataHistory)

Pick up from the last checkpoint in a data history. If you subsequently pass a data collector, data explorer, or data history to submit(), you should be sure to pass one with the same data history or all restored runs will be lost. Note: this function merely loads the run cache; it does not actually submit any runs. You must still specify the runs to perform and call submit() in order to continue evaluation. Parameters:

  • dataHistory: the Data History to restore from; if null uses the current data history; if non-null this becomes the current data history; you may pass a data explorer or data collector instead

Parameters:

  • IDispatch * dataHistory

Return type: void

Function setCustomMetadata

void ModelCenter::IJobManager::setCustomMetadata(BSTR name, BSTR key, BSTR value)

Add custom metadata to a variable.

Parameters:

  • name: Variable name.
  • key: the key of the metadata to add
  • value: the value of the metadata to add.

Parameters:

  • BSTR name
  • BSTR key
  • BSTR value

Return type: void

Connect with Ansys