Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
one_jh
airflow-test-jh
Commits
27bd3e01
Commit
27bd3e01
authored
May 11, 2022
by
one_jh
Browse files
Add new file
parent
9f0a88f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
passfail.py
0 → 100644
View file @
27bd3e01
from
airflow
import
DAG
from
datetime
import
datetime
,
timedelta
from
airflow.contrib.operators.kubernetes_pod_operator
import
KubernetesPodOperator
from
airflow.operators.dummy_operator
import
DummyOperator
default_args
=
{
'owner'
:
'airflow'
,
'depends_on_past'
:
False
,
'start_date'
:
datetime
.
utcnow
(),
'email'
:
[
'airflow@example.com'
],
'email_on_failure'
:
False
,
'email_on_retry'
:
False
,
'retries'
:
1
,
'retry_delay'
:
timedelta
(
minutes
=
5
)
}
dag
=
DAG
(
'kubernetes_sample'
,
default_args
=
default_args
,
schedule_interval
=
timedelta
(
minutes
=
10
))
start
=
DummyOperator
(
task_id
=
'run_this_first'
,
dag
=
dag
)
passing
=
KubernetesPodOperator
(
namespace
=
'default'
,
image
=
"Python:3.6"
,
cmds
=
[
"Python"
,
"-c"
],
arguments
=
[
"print('hello world')"
],
labels
=
{
"foo"
:
"bar"
},
name
=
"passing-test"
,
task_id
=
"passing-task"
,
get_logs
=
True
,
dag
=
dag
)
failing
=
KubernetesPodOperator
(
namespace
=
'default'
,
image
=
"ubuntu:1604"
,
cmds
=
[
"Python"
,
"-c"
],
arguments
=
[
"print('hello world')"
],
labels
=
{
"foo"
:
"bar"
},
name
=
"fail"
,
task_id
=
"failing-task"
,
get_logs
=
True
,
dag
=
dag
)
passing
.
set_upstream
(
start
)
failing
.
set_upstream
(
start
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment