Creating an Operator
If you would like to integrate your pipeline into Beagle with an Operator, please follow this guide
Last updated
Was this helpful?
If you would like to integrate your pipeline into Beagle with an Operator, please follow this guide
Last updated
Was this helpful?
Setup a local instance of Beagle (see ). Make sure to point to the staging Ridgeback instance using RIDGEBACK_ environment variables
Create test objects for the models that your operator will require
Most likely you will need to create Pipeline, Port, Operator, and File objects
Use , preferably in JSON format
Try to emulate how the data will look in the database for a real run. For example if a File has a sample ID, try to use one that is formatted similarly to how it will look in production, so that any operator logic can be reliably tested
See the below schema diagram to understand how these objects must be linked by their foreign keys
If you would like to do any testing outside of the subsequent unit tests, you should manually load these fixtures into your local Beagle database as the test DB will only be created at test runtime
Write a test case that loads these fixtures and calls the get_jobs() method of the Operator class
You can emulate this example here:
Include the “fixtures” attribute of the test case to automatically load the fixtures
Include assert statements any key aspects of the inputs file that you feel should be validated up front (such as sample IDs matching, or fields being present)
Now you can write the code for the Operator by implementing the get_jobs()
method of the Operator class
Notice how the relevant files are queried from the Beagle DB, and file paths are supplied as inputs to the pipeline
Make sure to register any input files in the Beagle DB using the /v0/files
endpoint
Test the operator by calling /v0/run/operator/runs/
through the Django Swagger UI
Once you have completed testing your operator, submit a PR to the Beagle codebase
You can look at this example operator to start: