GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — airflow-plugin/dags/example_evaluation_upload.py at master · rekcurd/airflow-plugin

Expand file tree

/

example_evaluation_upload.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
55 lines (42 loc) · 1.72 KB
/

example_evaluation_upload.py

Copy path

File metadata and controls

55 lines (42 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Example DAG where rekcurd_airflow plugins are used
"""
import airflow
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.operators.bash_operator import BashOperator
from rekcurd_airflow.operators import EvaluationUploadOperator
from datetime import timedelta
default_args = {
'owner': 'rekcurd-airflow',
'depends_on_past': False,
'start_date': airflow.utils.dates.days_ago(2),
'email': [],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(seconds=5),
}
EVAL_PATH = '/tmp/tmp_rekcurd_eval.txt'
def write_eval_file(**kwargs):
with open(EVAL_PATH, 'w') as f:
f.write('1\t0\t2\t3')
def print_evaluation_id(**kwargs):
result = kwargs['ti'].xcom_pull(task_ids='upload_file')
print('evaluation_id of uploaded data: ', result)
with DAG('example_evaluation_upload', default_args=default_args, schedule_interval="@once") as dag:
write = PythonOperator(task_id='write',
python_callable=write_eval_file,
provide_context=True)
# Upload data file to be evaluated to Rekcurd
upload_evaluation_file = EvaluationUploadOperator(
task_id='upload_file', project_id=1, app_id='sample_app',
description='sample file',
evaluation_file_path=EVAL_PATH)
print_id = PythonOperator(task_id='print',
python_callable=print_evaluation_id,
provide_context=True)
delete = BashOperator(task_id='delete',
bash_command='rm {}'.format(EVAL_PATH),
trigger_rule='all_done')
write >> upload_evaluation_file >> print_id >> delete
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.