Initializing help system before first use

Defining Custom Execution Modes

Every app is assigned two standard execution modes: LOAD and RUN. A model can also define any number of additional custom execution modes—they can offer your app two additional forms of control:
  • Executing different model code paths based on the execution mode selected by a user.
  • Routing different kinds of Xpress Insight jobs to different worker resources configured on the server.
Custom Execution Load and Run Modes cannot be triggered from the Scenario pill menu, they require an extra button in the Xpress Insight user interface.
Note For more on Execution Modes, see Understanding Execution Modes.

Code Snippet

Years: xi.Index(dtype=xi.integer, alias="Years")
Cities: xi.Index(dtype=xi.string, alias="Cities")
InputArrayStr: xi.Series(index=['Years', 'Cities'], dtype=xi.string, alias="Input Array Of String")
MixedTable: xi.DataFrame(index='Years', columns=[
    xi.Column("IntCol", dtype=xi.integer, alias="Input Integer Column"),
    xi.Column("StrCol", dtype=xi.string, alias="Input String Column", update_after_execution=True),
    xi.Column("ResultCol", dtype=xi.real, alias="Result Real Column", manage=xi.Manage.RESULT)
])

Example Custom Run function

@xi.ExecMode(name="CUSTOM_RUN", descr="Custom run execution mode.", clear_input=False)
def my_custom_run_mode(self):
    print('CUSTOM_RUN mode...')
    self.MixedTable['ResultCol'] = self.MixedTable.IntCol * 2.0
    self.MixedTable.ResultCol.at[2020] = 999999
    self.MixedTable.StrCol.at[2018] = 'Updated after CUSTOM_RUN mode'
    print('CUSTOM_RUN finished.')
This is the most common way to create an additional run mode. In this example:
  • The name is explicitly stated (name="CUSTOM_RUN")
  • The clear_input parameter (clear_input=False) allows you to specify whether the custom execution mode behaves like to the built in load or run mode. In this case, it behaves like the built-in run mode.
  • When it is executed, all inputs are initialized, and all results are extracted and written to the database. Additionally, any Inputs marked as 'update after execution' are also updated—This is normally used when pre-processing data prior to final calculation.

Example Custom Load function

@xi.ExecMode(name="CUSTOM_LOAD", descr="Custom load execution mode.", clear_input=True)
def custom_load(self):
    print('CUSTOM_LOAD mode...')
    self.load_from_file('series.csv', 'data_frame.csv')
    self.MixedTable.StrCol.at[2020] = 'CUSTOM LOAD MODE'
    print('CUSTOM_LOAD finished.')

This example behaves the same as a standard load mode, but has an alternative name: CUSTOM_LOAD.

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.