Life Cycle Actions

After completing the first version of our pipeline component, the project is ready to iterate through its life cycle. Let’s perform the standard actions using the CLI as the execution mechanism.

Development Life Cycle

  1. Change the directory to the root of the forml-tutorial-titanic project working copy.

  2. Let’s first run all the defined operator unit tests to confirm the project is in a good shape:

    $ forml project test
    running test
    TestNaNImputer
    Test of Invalid Params ... ok
    TestNaNImputer
    Test of Not Trained ... ok
    TestNaNImputer
    Test of Valid Imputation ... ok
    TestTitleParser
    Test of Invalid Params ... ok
    TestTitleParser
    Test of Invalid Source ... ok
    TestTitleParser
    Test of Valid Parsing ... ok
    ----------------------------------------------------------------------
    Ran 6 tests in 0.591s
    
    OK
    
  3. Try running the train action on the Graphviz runner (called visual in our config) to see the train task graph:

    $ forml project train --runner visual
    
    ../../_images/titanic-train.png
  4. Run the eval action on the (default) Dask runner (called compute in our config) to get the cross-validation score:

    $ forml project eval
    0.8379888268156425
    

    …great, we have managed to improve from our baseline workflow!

  5. Create the project package artifact and upload it to the (default as per our config) file system registry (assuming the same release does not already exist - otherwise increment the project version in the pyproject.toml):

    $ forml project release
    

    This should publish the project into your local file system model registry making it available for the production life cycle. It becomes the first published release of this project versioned as 0.1.dev1 (according to the version from pyproject.toml).

Production Life Cycle

The production life cycle does not need the project working copy, so feel free to change the directory to another location before executing the commands.

  1. List the local registry confirming the project has been published as its first release:

    $ forml model list
    forml-tutorial-titanic
    $ forml model list forml-tutorial-titanic
    0.1.dev1
    $ forml model list forml-tutorial-titanic 0.1.dev1
    

    The output shows the project artifact is available in the registry as a release 0.1.dev1 not having any generation yet (the last command not producing any output).

  1. Train the project (using the default runner as per our config) to create the first generation of its models and list the registry to confirm it got persisted:

    $ forml model train forml-tutorial-titanic
    $ forml model list forml-tutorial-titanic 0.1.dev1
    1
    

    Now we have our first generation of Titanic models available in the registry.

  1. Apply the trained generation to the test dataset to get the predictions:

    $ forml model apply forml-tutorial-titanic
    [0.10563631 0.32648719 0.11243692 0.17620626 0.58286405 0.17833955
     0.81009676 0.10064623 0.84965811 0.08915972 0.13542787 0.2049216
    ...
     0.89760968 0.7289824  0.79378986 0.91791833 0.55937149 0.09801463
     0.93010752 0.09111896 0.21376298 0.84650916]
    
  2. Run the apply mode alternatively on the Graphviz runner to explore its task graph:

    $ forml model -R visual apply forml-tutorial-titanic
    
    ../../_images/titanic-apply.png

Now, after exploring two of the execution mechanisms (namely the interactive mode demonstrated during the exploratory analysis and the command-line-driven batch processing shown in this chapter), we can proceed to the final deployment and serving.