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
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
3ab26710
Commit
3ab26710
authored
4 months ago
by
lcd22
Browse files
Options
Downloads
Patches
Plain Diff
voltando para o normal
parent
e3f92da5
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
dags.py
+1
-27
1 addition, 27 deletions
dags.py
with
1 addition
and
27 deletions
dags.py
+
1
−
27
View file @
3ab26710
...
...
@@ -14,27 +14,6 @@ from airflow.operators.python import PythonOperator
repo_home
=
'
/opt/airflow/dags/repo
'
# Função para limpar o buckets do Minio
def
clean_buckets
():
# Configurar cliente do Minio
minio_client
=
Minio
(
"
http://minio.minio-cluster.svc.cluster.local:9000
"
,
access_key
=
"
minioadmin
"
,
secret_key
=
"
minioadmin
"
,
secure
=
True
)
bucket_names
=
[
"
bronze
"
,
"
silver
"
,
"
gold
"
]
for
bucket_name
in
bucket_names
:
try
:
# Listar objetos no bucket e remover
for
obj
in
minio_client
.
list_objects
(
bucket_name
):
minio_client
.
remove_object
(
bucket_name
,
obj
.
object_name
)
print
(
f
"
Objeto
{
obj
.
object_name
}
removido com sucesso!
"
)
except
ResponseError
as
err
:
print
(
f
"
Erro ao limpar o bucket:
{
err
}
"
)
@dag
()
def
process_records
():
...
...
@@ -59,12 +38,7 @@ def process_records():
bash_command
=
"
dbt deps && dbt build
"
,
)
task_4
=
PythonOperator
(
task_id
=
"
clean_buckets
"
,
python_callable
=
clean_buckets
)
task_1
>>
task_2
>>
task_3
>>
task_4
task_1
>>
task_2
>>
task_3
dag
=
process_records
()
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