SetPythonModule

Syntax

SetPythonModuleResult SetPythonModule(OdId tObject, SetPythonModuleArg tArg)

Parameters

tObject. Moniker of repository object that is a Python unit.

tArg. Operation execution parameters.

Description

The SetPythonModule operation is used to change Python unit code and start it for execution.

Comments

To execute the operation, in the tObject field specify moniker of the repository object that is a Python unit. The object moniker can be obtained on executing the GetObjects operation. In the tArg.meta field specify new metadata of the unit, which should be applied. Changes are saved on executing the operation.

The tArg.run parameter enables the user to start a Python unit for execution.

The operation results in the information about compilation results and unit execution results.

Example

Below is the example of starting a Python unit for execution. The request contains moniker of unit in the repository. The response contains text of messages displayed in the console on execution. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetPythonModule xmlns="http://www.fsight.ru/PP.SOM.Som">
<tObject xmlns="">
  <id>LGAABCFKMMJNFOAEJHAJNCGDICAAELAEKLDHEEPJJFLLCAAC!M!304842</id>
  </tObject>
<tArg xmlns="">
  <run>true</run>
  </tArg>
  </SetPythonModule>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetPythonModuleResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <consoleOutput xmlns=""> Today: 08-Jul-2022</consoleOutput>
  </SetPythonModuleResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetPythonModule" :
{
"tObject" :
{
"id" : "LGAABCFKMMJNFOAEJHAJNCGDICAAELAEKLDHEEPJJFLLCAAC!M!304842"
},
"tArg" :
{
"run" : "true"
}
}
}

JSON response:

{
"SetPythonModuleResult" :
{
"consoleOutput" : " Today: 08-Jul-2022"
}
}
public static SetPythonModuleResult RunPythonModule(MbId mb, string modId)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetPythonModule()
{
tArg = new SetPythonModuleArg()
{
run = true
},
// Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, modId).k }
};
// Start Python unit
var result = somClient.SetPythonModule(tSet);
return result;
}

See also:

Working with Development Environment