Skip to main content

Running a task using the SDK

Use the Bitfount Python SDK to submit and manage tasks programmatically. This may be useful for more technical users who want to automate tasks or integrate Bitfount into their existing workflows.

Prerequisites

  • Bitfount SDK installed - see SDK Installation
  • Access to the dataset(s) and model(s) you intend to use
    • The model must be either public, owned by yourself, or part of a project's task in which you are an owner or collaborator
    • The dataset must be either owned by yourself or part of a project in which you are an owner or collaborator and the owner of the dataset has granted permission for other project collaborators to use it. If owned by yourself, the dataset can be connected through the App or through the SDK as described in the Connecting Datasets guide

Methods

There are two main methods for running a task using the SDK:

  • Running a task from the command line pointing to a task YAML file
  • Running a task from a Python script

Running a task from a task file

Running a task from the command line is as easy as running the following command:

bitfount run_modeller <path-to-task-yaml-file>

This will run the task and output the results to the console as well as to a logfile in a subdirectory of the current working directory called bitfount_logs.

tip

Make sure you have specified the dataset identifiers and the project id correctly in the task YAML file to avoid timeouts or authentication errors.

Running a task from a Python script

Running a task from a Python script requires creating all the necessary components of a task as python objects ending with the protocol object. The protocol object is the entry point for the task and is used to orchestrate the algorithms and handle communication between different parties within the task. Calling the run method on the protocol object with the dataset identifiers passed as an argument will kick off the task.

There are several examples of how to start tasks this way in the Tutorials section.