Managing pipelines
- Getting started
- Creating an Apache Airflow™ cluster
- Service account access
- Adding a pipeline
- Viewing a list of pipelines
- Enabling and disabling a pipeline
- Running a pipeline manually
- Backfill
- Viewing runs and tasks
- Viewing logs and XCom
- Managing runs
- Viewing pipeline code and parameters
- DAG file import errors
- Checking the cluster health
Under
Getting started
Set up the following:
- DataLens Platform environment.
- Git repository with your DAG files and an SSH key to access it.
- Collection to host the Apache Airflow™ cluster. Make sure you have the required permissions to create objects in the collection.
To work with an existing cluster, obtain the required permissions for the cluster or the collection where it resides. If you see an access denied message, contact your administrator.
Before running pipelines, make sure the cluster’s service account has the required access permissions the data and computing resources they use.
Creating an Apache Airflow™ cluster
If you already have a cluster, proceed to adding a pipeline.
To create a cluster:
-
In the left-hand panel, select
Orchestrator and click Enable Airflow. -
Under General settings, specify the Git repository settings:
- Repository address: SSH connection address.
- Path to files directory: Path to the directory containing DAG files in the Git repository.
- Branch: Branch to fetch DAG files from.
- SSH key: Private key content. The matching public key must grant read access to the Git repository.
-
In the Environment field, select the environment already set up or create a new one.
Make sure your Apache Airflow™ cluster and the platform objects used by its pipelines reside in the same cloud and environment.
-
If your DAGs require additional Python dependencies, specify them in the Pip packages field under Other settings. List each dependency on a separate line either as a package name alone or as a package name followed by
==and the exact version. You can specify additional package components, such as follows:numpy requests[security,socks] -
Click Create cluster.
-
In the Select collection window, select where to locate the new cluster and click Create cluster.
-
Wait for the operation to complete. After the cluster is created, you will see a list of pipelines.
Apache Airflow™ and Python versions are set by DataLens Platform.
Service account access
The service account is created automatically with the cluster and used by all its pipelines. If a pipeline accesses DataLens Platform objects, the service account needs access permissions for those objects. For example, running a saved SQL query requires permissions to access the script, connection, data, and computing resources used in the Trino cluster. Apache Spark™ jobs require access permissions for data and computing resources in the associated cluster. User permissions for managing pipelines do not replace the service account’s permissions.
To find the cluster’s service account and request access:
- In the left-hand panel, select
Orchestrator. - At the top of the page, locate the Service account card. It specifies the ID of the account used to run pipeline tasks.
- In the card, click
and select Request access.
Learn more about configuring object access permissions here.
Adding a pipeline
A pipeline is defined in a DAG file, which specifies the tasks, dependencies between them, and the schedule. Apache Airflow™ fetches DAG files from the Git repository connected to the cluster.
To add a pipeline:
- Create a DAG file describing the data processing workflow.
- Add the file to the Git repository directory specified when creating the cluster. Use the branch selected for the cluster.
- Push your changes to the Git repository and wait for synchronization with the cluster.
- In DataLens Platform, open the
Orchestrator section and find the pipeline you added in the Pipelines tab.
If the pipeline is missing, check for DAG file import errors.
Viewing a list of pipelines
To open a list of pipelines, select
- Apache Airflow™ cluster: Cluster name, Apache Airflow™ version, and status, such as Running.
- Service account: ID of the account used to run pipeline tasks. The card menu provides the Request access option.
- Git repository: URL of the connected repository and branch name for the DAG files.
The page displays the following tabs:
- Pipelines: List of imported DAGs.
- Pipeline runs: Execution history for all pipelines.
- Task runs: Execution history for individual tasks.
To find a pipeline, enter its name in the Search by name field on the Pipelines tab. Select Active or Stopped to filter pipelines by status. To clear the status filter, select All. Additional filtering options include Last run and Filter by tag.
To quickly access recently opened or favorite pipelines, use Recent and Favorites. To add a pipeline to your favorites, click
The table shows each pipeline’s name, status, description, schedule, and next and last runs. In the Last run column, you can check the execution result and open a specific run by clicking the date link. To customize the table columns, click
To open a pipeline, click its name. At the top of the pipeline page, you will see its schedule, last and next runs, tags, and latest version.
Enabling and disabling a pipeline
To enable a pipeline:
- In the left-hand panel, select
Orchestrator and go to the Pipelines tab. - Find the pipeline and turn on the toggle next to it.
Apache Airflow™ will create pipeline runs based on the schedule defined in the DAG file. To change the schedule, update the file in the cluster’s DAG file storage and wait for synchronization to complete.
To disable a pipeline, turn off the relevant toggle in the list or open the pipeline page and click Disable in the top-right corner. This disables future scheduled runs without interrupting tasks that are already running.
To enable the pipeline, turn on the toggle. Depending on the catchup parameter in the DAG file, enabling the pipeline may trigger runs for missed periods. Learn more about catchup in this Apache Airflow™ guide
Running a pipeline manually
To run a pipeline manually:
- In the left-hand panel, select
Orchestrator, go to the Pipelines tab, and find the pipeline. - If the pipeline is disabled, enable it.
- Open the pipeline, go to the Runs tab, and click Manual run.
- In the Run type field, select Manual run.
- Specify the Logical run date. It is used in the DAG context and may differ from the actual execution time. This field does not schedule the pipeline to run at a later time.
- If the pipeline accepts parameters, provide them in the JSON configuration field. The available parameters are determined by the DAG code.
- Click Execute.
- Navigate to the Runs tab, locate the run you created, and check its status.
Learn more about the logical date and providing parameter in this Apache Airflow™ guide
Backfill
Backfill creates pipeline runs for the selected period based on the schedule specified in the DAG file. Use it to process missing data or rerun processing for past dates. Backfill requires DAGs to have a time-based schedule.
To create a backfill:
-
In the left-hand panel, select
Orchestrator, go to the Pipelines tab, and find the pipeline. -
If the pipeline is disabled, enable it.
-
Open the pipeline, go to the Runs tab, and click Manual run.
-
In the Run type field, select Backfill.
-
In the Period field, specify the start and end dates.
-
In the Which runs to create field, select a reprocess behavior:
- Missing: Create only missing runs.
- Missing and errored: Create missing runs and retry errored runs.
- All: Create missing runs and rerun all completed runs, including successful ones.
-
In the Max active runs field, set the maximum number of concurrent backfill runs.
-
Optionally, enable the following:
- Run backwards: To process later dates first.
- Run with the latest package version: To use the latest version of the code.
-
Click Run.
-
To check the backfill you created, open the Backfills tab on the pipeline page. You can also view individual runs on the Runs tab by selecting Run type → Backfill in the filters.
If a run for the selected logical date is already in progress or queued, no new run is created for that date. For more on backfill, see this Apache Airflow™ guide
Viewing runs and tasks
To check the pipeline’s execution:
- In the left-hand panel, select
Orchestrator, go to the Pipelines tab, and find the pipeline. - Open the pipeline and navigate to the Runs tab.
- Select a period. Optionally, use search and the Status and Run type filters.
- Select the run row in the table. The graph on the right shows the tasks and their statuses for the selected run. You can also select the run from the list above the graph.
- To open the run details, click the run ID in the table on the left.
The run page shows the run’s status, type, execution time, duration, logical date, and version, as well as a list of tasks. To investigate a task error, open the relevant task from the list. For details on how to view logs, see Viewing logs and XCom.
To view the pipeline structure, navigate to the Tasks tab. The table lists task names, trigger rules, maximum number of retry attempts, and operators. Select a task in the table to highlight it in the graph. Task groups are shown as separate blocks.
To view run history across all pipelines, return to
Viewing logs and XCom
To investigate why a task failed:
- Open the pipeline run page.
- In the task list, select the task and open its page.
- On the Logs tab, select an execution attempt if the task ran multiple times.
- Optionally, filter messages by level and source using the All levels and All sources dropdowns.
- Review the error messages. To customize the log display, click Log settings.
To save the logs to a file, click
The XCom tab displays the values the task shared through Apache Airflow™ XCom. Learn more about XCom in this Apache Airflow™ guide
Managing runs
To view the available actions for existing runs, select
Rerunning
To rerun a pipeline execution:
- Find the run and select Rerun from its menu.
- Confirm the action in the dialog that opens.
This will reset the run’s task states and rerun the tasks.
Changing a status
To change a run status manually:
- Find the run and select Change status from its menu.
- Under New status, select Success or Failed.
- Optionally, enter a comment in the Comment field.
- Click Change status.
Note
Manually changing the status does not process any data or resolve the cause of the failure.
Deleting a run
Warning
Deleting a run permanently removes it and its associated data from Apache Airflow™.
To delete a run:
- Find the run and select Delete from its menu.
- In the window that opens, confirm the deletion.
Viewing pipeline code and parameters
To view a DAG file, open the pipeline and go to the Code tab. To change the processing logic, set of tasks or schedule, update the file in the cluster’s DAG file storage and wait for synchronization to complete.
To view the pipeline’s parameters and execution statistics, go to the Details tab.
DAG file import errors
If a DAG file contains an error or lacks a required dependency, the pipeline may not appear in the list. The DAG file import errors message is displayed in the
To view the errors:
- Click Details in the error message.
- In the window that opens, find the file using the Search by file field.
- Expand the entry for the file. Check the error timestamp, package name, and stack trace.
- Fix the code or dependencies and wait for the DAG file to re-import.
- Make sure the error is gone and the pipeline appears in the list.
Checking the cluster health
To check the Apache Airflow™ status, click
- Metadata database
- Scheduler
- Trigger
- DAG processor
If the data fails to load, click Retry when the button appears. If the issue persists, provide the details of the unavailable components and the error message to the the administrator.