Skip to content

Workspaces

Workspaces are environments that contain data by hosting Feature Stores. Every Tecton cluster contains one Workspace named prod that has a production serving layer. This production workspace is the only workspace that can materialize or serve feature values in real-time.

You can create any number of non-production workspaces using the CLI. The workspace data can then be viewed in the Web UI and accessed via the Tecton SDK. Use non-production workspaces to perform experimental and exploratory development without affecting the production namespace.

Defining a Workspace

Create a new workspace using the CLI. The new workspace is empty in the remote Tecton cluster, with no working or committed files, until Feature Store configuration files are applied to it.

To create a new workspace based on prod, do the following:

  1. Create a new empty Workspace.

    RunΒ tecton workspace create my_workspace:

    $ tecton workspace create my_workspace
    Created workspace "my_workspace".
    Switched to workspace "my_workspace".
    You're now on a new, empty workspace. Workspaces isolate their state,
    so if you run "tecton plan" Tecton will not see any existing state
    for this configuration.
    
  2. Create a new Git branch.

    To develop using the existing production state as a base, clone a new Git branch fromΒ mainΒ  in which to store changes made in your workspace:

    # Create a new git branch
    git checkout -b "my_workspace_branch"
    Switched to new branch "my_workspace_branch"
    
  3. Apply the current state to your new workspace.

    The new workspace my_workspace is empty. RunΒ tecton applyΒ so that the new workspace reflects the current prod state, which has been captured in your local Git branch.

    $ tecton apply
    βœ… Imported 11 Python modules from the feature repository
    βœ… Collecting local feature declarations
    ↓↓↓↓↓↓↓↓↓↓↓↓ Plan Start ↓↓↓↓↓↓↓↓↓↓
    + Create FeatureView name: prod_feature owner: user ...
    ↑↑↑↑↑↑↑↑↑↑↑↑ Plan End ↑↑↑↑↑↑↑↑↑↑↑↑
    Are you sure you want to apply this plan? [Y/n] Y
    All done!
    

You now have a development environment with a workspace and a Git branch that reflect the current state of the TectonΒ prod environment.

Interacting with Workspaces

Once you create a workspace and apply it to the remote Tecton cluster, you can use it interactively for feature engineering and exploratory development.

When development is completed, apply the changes back to the prod workspace by merging the new code back into the main branch of the codebase. You can then delete the workspace or preserve it as a record of the development work.

Once you create a workspace and apply features to that workspace, data scientists can interact with and develop in it using the Tecton SDK.

To view objects in your workspace, do the following in your interactive notebook:

  1. Switch into the new workspace using the TectonΒ WorkspaceΒ class:

    import tecton
    # Get my workspace
    my_experiment_workspace = tecton.get_workspace("my_workspace")
    
  2. Fetch a Feature View from the workspace:

    experimental_fv =
    my_experiment_workspace.get_feature_View("my_experimental_feature")
    
  3. Preview features from the Feature View:

    from datetime import datetime
    from datetime import timedelta
    experimental_fv.get_features(start_time=(datetime.now() - timedelta(days = 7), from_source=True)