-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement LivyOperatorAsync
#178
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
c3aecc4
Add apache livy requirements in setup.cfg
sunank200 e725c8d
Add LivyOperatorAsync, LivyTrigger and LivyHookAsync
sunank200 3c62273
Add example DAG for LivyOperatorAsync and __init__.py
sunank200 1324b50
Propagate the log from triggerer to worker
sunank200 78c2da5
Add __init__.py in folder structure
sunank200 0f23c82
Propagate the log in case of error from triggerer to worker
sunank200 d887c6d
Change sleep to asyncio.sleep
sunank200 e9566bf
Add request_mocks in tests in setup.cfg
sunank200 8d0d354
Add the tests for hooks, operators and triggerer
sunank200 3ef53ac
Fix the typo in test for triggers
sunank200 71eebbe
Add missing log lines and change the test accordingly
sunank200 c924300
Add test for error scenarios for hooks
sunank200 644dc92
Remove comment for apache foundation license
sunank200 057ddb8
Add the comment for module name in trigger
sunank200 04c8937
Add extra_option example in docstring
sunank200 64a3792
Remove the licenses for Apache Software Foundation
sunank200 132fa19
Rewrite the relevant docstrings in tests
sunank200 54da2a1
Add the correct typehint as per docstring and remove dict from logs
sunank200 24092a3
Add getter to dictionary object
sunank200 f1f7fe1
Remove the redundant logic from the trigger
sunank200 57986db
Add relavent docstring for poll interval
sunank200 8fab5a5
Add relavent docstrings for polling_interval in trigger
sunank200 18c4719
Add example for spark_params in docstrings
sunank200 dd0e58f
remove request_mock
sunank200 8fdfea4
Fix mypy errors
sunank200 e14f0f2
Update setup.cfg
sunank200 88b1875
Merge branch 'livy-operator-async' of https://github.com/astronomer/a…
sunank200 a045201
Update astronomer/providers/apache/livy/hooks/livy.py
sunank200 cc5ada8
Fix the docstrings in build_post_batch_body in the hooks
sunank200 7b25ec1
Merge branch 'livy-operator-async' of https://github.com/astronomer/a…
sunank200 0ddab2a
Remove doc string from private method
sunank200 62f2d60
remove the liscense and add tag to example dag
sunank200 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
40 changes: 40 additions & 0 deletions
40
astronomer/providers/apache/livy/example_dags/example_livy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
This is an example DAG which uses the LivyOperatorAsync. | ||
The tasks below trigger the computation of pi on the Spark instance | ||
using the Java and Python executables provided in the example library. | ||
""" | ||
import os | ||
from datetime import datetime | ||
|
||
from airflow import DAG | ||
|
||
from astronomer.providers.apache.livy.operators.livy import LivyOperatorAsync | ||
|
||
LIVY_JAVA_FILE = os.environ.get("LIVY_JAVA_FILE", "/spark-examples.jar") | ||
LIVY_PYTHON_FILE = os.environ.get("LIVY_PYTHON_FILE", "/user/hadoop/pi.py") | ||
|
||
with DAG( | ||
sunank200 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dag_id="example_livy_operator", | ||
default_args={"args": [10]}, | ||
schedule_interval=None, | ||
start_date=datetime(2021, 1, 1), | ||
catchup=False, | ||
tags=["example", "async", "deferrable", "LivyOperatorAsync"], | ||
) as dag: | ||
|
||
# [START create_livy] | ||
livy_java_task = LivyOperatorAsync( | ||
task_id="pi_java_task", | ||
file=LIVY_JAVA_FILE, | ||
num_executors=1, | ||
conf={ | ||
"spark.shuffle.compress": "false", | ||
}, | ||
class_name="org.apache.spark.examples.SparkPi", | ||
polling_interval=0, | ||
sunank200 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
livy_python_task = LivyOperatorAsync(task_id="pi_python_task", file=LIVY_PYTHON_FILE, polling_interval=30) | ||
|
||
livy_java_task >> livy_python_task | ||
# [END create_livy] |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This DAG still needs work to be self sufficient. We might want to use existing operators and boto3 api to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am working on this right now.