Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
airflow-dags
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Team DB
airflow-dags
Commits
1003c213
Commit
1003c213
authored
3 months ago
by
edvs19
Browse files
Options
Downloads
Patches
Plain Diff
teste
parent
3570e95a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
teste_dag.py
+67
-0
67 additions, 0 deletions
teste_dag.py
with
67 additions
and
0 deletions
teste_dag.py
0 → 100644
+
67
−
0
View file @
1003c213
import
datetime
from
airflow
import
DAG
from
airflow.decorators
import
dag
,
task
from
airflow.operators.empty
import
EmptyOperator
from
airflow.operators.bash
import
BashOperator
from
airflow.operators.trigger_dagrun
import
TriggerDagRunOperator
from
airflow.models.param
import
Param
from
airflow.providers.apache.spark.operators.spark_submit
import
SparkSubmitOperator
repo_home
=
'
/opt/airflow/dags/repo
'
@dag
(
params
=
{
"
input_file
"
:
Param
(
"
nofile.jsonl
"
,
"
jsonl to be used as input in landing to bronze
"
,
str
)
}
)
def
process_records
(
params
:
dict
):
"""
DAG que realiza o fluxo landing -> bronze -> silver -> gold
"""
task_1
=
SparkSubmitOperator
(
application
=
f
"
{
repo_home
}
/gen_bronze.py
"
,
task_id
=
"
landing_to_bronze
"
,
packages
=
"
org.apache.hadoop:hadoop-aws:3.3.4
"
)
task_2
=
BashOperator
(
task_id
=
"
dbt_setup
"
,
bash_command
=
f
"
rm -rf /tmp/proj_teste && cp -r
{
repo_home
}
/proj_teste /tmp/proj_teste
"
,
)
task_3
=
BashOperator
(
task_id
=
"
bronze_to_silver_to_gold
"
,
cwd
=
"
/tmp/proj_teste
"
,
bash_command
=
"
dbt deps && dbt build
"
,
)
task_1
>>
task_2
>>
task_3
@dag
def
teste
(
params
=
{
"
input_file
"
:
Param
(
type
=
str
)
}
):
print
(
params
.
input_file
)
@dag
def
run_tests
():
dgr
=
TriggerDagRunOperator
(
trigger_dag_id
=
"
other_dag
"
,
task_id
=
"
teste
"
,
conf
=
{
"
file_path
"
:
"
{{ params.file_path }}
"
}
)
dag2
=
teste
()
# dag3 = run_tests()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment