Legacy. Use run instead.


The main function is one of two functions executed by the Python scripting - with input table operator (the other being simple_main).

Other than simple_main, this function does not return a result table, but rather a list of workflows, each containing a sequence of asynchronous generators.

To understand the workings of this, it helps to be familiar with generatorsasynchronous generators and coroutines.

The function takes the following arguments

  • params: parameters of the current project as dictionary mapping parameter name → parameter value
  • inputs: list of generators that yield a current result table row-by-row, where inputs[0] yields the current result table and inputs[i] for i>0 the result tables tables of data nodes referenced in the operator settings.
  • outputs: list of generators that yield the new result table(s) row-by-row where outputs[0] yields the updated result table. In the current version, only this table can be used.
  • **kwargs: dictionary of additional arguments. Among these are:
    • filereaders: list of asyncio.StreamReader objects for reading TIS files asynchronously. Refer to TIS File I/O for more details. Available starting from TIS v6.2.
    • filewriters: list of BufferedStreamWriter objects for writing TIS files asynchronously. Refer to TIS File I/O for more details. Available starting from TIS v6.2.
    • sessionUrl, sessionToken: current session's token and URL for pytisapi use. e.g. with Editor.from_token(baseurl=kwargs['sessionUrl'], token=kwargs['sessionToken']) as tiseditor: v6.2

The function returns 

  • a list of workflows, and
  • a dictionary mapping table → function where 
    • table is an input or output table contained in inputs or outputs, and 
    • function is a function returning references to two dictionaries types and columns for each table. These dictionaries are declared at the beginning of the main function and contain the  tables' schema information as follows>
      • typesdata types of columns in result table as dictionary mapping column index → type, and
      • columns: column names of result table as dictionary mapping column name → column index.

The python operator links the schema information of each table referenced in the second return value to the respective function and then builds an event loop to process the workflow.