Isabl Docs
Search…
Operational Automations
πŸ€– Once you have set up your Isabl instance and created a few applications you can now automate your processes! In Isabl, this is achieved using signals.

Operational Signals

Signals are python functions that take one argument: an experiment or an analysis. Signals for experiments are triggered on data import, whilst signals for analyses are triggered on status change (i.e. analysis failure or completion).

Registering Signals

Register signals by including the function import string in either ON_STATUS_CHANGE or ON_DATA_IMPORT Isabl CLI settings:
1
# experiments signals are triggered on data import
2
"ON_DATA_IMPORT": [
3
"my_apps.signals.trigger_apps"
4
]
5
​
6
# analyses signals are triggered on status change
7
"ON_STATUS_CHANGE": [
8
"my_apps.signals.trigger_dependencies"
9
]
Copied!

Signals on Data Import

Signals for experiments are triggered on data import and receive the experiment object as its only argument. You can use the metadata of the experiment to determine what automation should be applied.
1
from isabl_apps import apps
2
​
3
​
4
def signal_data_import(experiment):
5
"""Run upon data import using the cli."""
6
species = experiment.sample.individual.species
7
category = experiment.technique.category
8
dna_aligner = {"HUMAN": apps.BwaMemGRCh37, "MOUSE": apps.BwaMemGRCm38}.get(species)
9
tuples = [([experiment], [])]
10
​
11
if category == "DNA" and dna_aligner:
12
dna_aligner().run(tuples=tuples, commit=True)
Copied!
Some examples are:
    Trigger assembly/species/category aware alignment
    Perform Gene quantification or Fusion calling in RNA
    Create symlinks to the raw data that are more human accessible

Signals on Analysis Status Change

Analyses signals are triggered on status change. Each signal will receive the analysis object as its only argument. You can use the metadata of the experiment to determine what automation should be applied.
1
from isabl_apps import apps
2
​
3
​
4
def signal_apps_automation(analysis):
5
"""Run upon an analysis status update in the database."""
6
qc_app = {
7
"GRCh37": apps.QualityControlGRCh37,
8
"GRCm38": apps.QualityControlGRCm38,
9
}.get(analysis.application.assembly.name)
10
​
11
if (
12
analysis.status == "SUCCEEDED"
13
and analysis.application.name in ["DISAMBIGUATE", "BWA_MEM", "STAR"]
14
and qc_app
15
):
16
qc_app().run(tuples=[(analysis.targets, [])], commit=True)
Copied!
Some examples are:
    Trigger Quality Control/Coverage calculation after alignment has successfully been run
    Trigger Variant Calling after alignment
    Trigger Report Generation after analyses have been completed

Working with Signals

Here are a few examples of how to work with signals, trigger them, and get notified if signals fail.

Running Signals Manually

You can trigger signals manually with Isabl CLI:
1
# experiment signals
2
isabl run-signals experiments -s my_apps.signals.trigger_apps -fi projects 100
3
​
4
# analyses signals
5
isabl run-signals analyses -s my_apps.signals.trigger_dependencies -fi projects 100
Copied!

Rerunning Failed Signals

When signals fail during automation, database records are created to keep track of this event. Rerun failed signals with:
1
# rerun all failed signals
2
isabl rerun-signals
3
​
4
# rerun failed signals using filters
5
isabl rerun-signals \
6
-fi import_string my_apps.signals.trigger_apps \
7
-fi target_endpoint analyses \
8
-fi target_id <an analysis primary key>
Copied!

Get Notified When Signals Fail

You can configure Isabl API to periodically check if any signal has failed and send you email notifications. To do so, head to the admin site at /admin/django_celery_beat/periodictask/add/ and in Task (registered) select isabl_api.tasks.report_failed_signals_task, then create a 15 minutes interval, and hit save:
​
Last modified 1yr ago