-
Notifications
You must be signed in to change notification settings - Fork 9
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
Topic/fault tolerance #34
Open
pgzmnk
wants to merge
7
commits into
anyscale:main
Choose a base branch
from
pgzmnk:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1a515b9
Incorporate Fault Tolerance mechanism and its tests.
pgzmnk c195a88
Implement checkpointing in AWS S3.
pgzmnk 24338f8
Incorporate checkpoint flag.
pgzmnk 94b0e2c
Incorporate checkpoint_on_retry_callback to _retrieve_obj_id_from_xco…
pgzmnk 70fc934
Create test to validate different Ray versions.
pgzmnk 7beb063
Update tests.
pgzmnk 5cb7844
Add logging on file write to ray_decorators.py
pgzmnk 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
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
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
from airflow.decorators import dag, task | ||
from ray_provider.decorators.ray_decorators import ray_task | ||
from ray_provider.xcom.ray_backend import RayBackend | ||
|
||
|
||
from datetime import datetime | ||
|
||
|
||
default_args = { | ||
"owner": "airflow", | ||
"on_success_callback": RayBackend.on_success_callback, | ||
"on_failure_callback": RayBackend.on_failure_callback, | ||
"retries": 1, | ||
"retry_delay": 0, | ||
} | ||
|
||
task_args = { | ||
"ray_conn_id": "ray_cluster_connection", | ||
} | ||
|
||
|
||
@dag( | ||
default_args=default_args, | ||
schedule_interval=None, | ||
start_date=datetime(2020, 1, 1, 0, 0, 0), | ||
tags=['demo'] | ||
) | ||
def demo(): | ||
|
||
@ray_task(**task_args) | ||
def load_data1(): | ||
return 1 | ||
|
||
@ray_task(**task_args) | ||
def load_data2(): | ||
return 2 | ||
|
||
@ray_task(**task_args) | ||
def transform_data(data, data2): | ||
return data * data2 * 100 | ||
|
||
# Upstream outputs save to GCS when this task retries | ||
@ray_task(**task_args) | ||
def divide_by_zero(data): | ||
return data/0 | ||
|
||
the_data1 = load_data1() | ||
the_data2 = load_data2() | ||
the_transformed_data = transform_data(the_data1, the_data2) | ||
divide_by_zero_output = divide_by_zero(the_transformed_data) | ||
|
||
|
||
demo_dag = demo() |
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.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Oh, this is basically the implementation of the task?
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.
Can you leave a docstring here?
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.
Previously, the ray decorator used the
PythonOperator
.Assigning the recovered objects as Task attributes requires modifying to the
pre_execute
method of thePythonOperator
.RayPythonOperator
subclasses thePythonOperator
; it sets a custompre_execute
method and implements logic to enable attribute assignment.