Created
February 10, 2022 09:58
-
-
Save vsergeyev/8080b0c9d789e45aec5d04710935cb50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import ray | |
from ray import workflow | |
from typing import List | |
@workflow.step | |
def read_data(num: int): | |
return [i for i in range(num)] | |
@workflow.step | |
def preprocessing(data: List[float]) -> List[float]: | |
return [d**2 for d in data] | |
@workflow.step | |
def aggregate(data: List[float]) -> float: | |
return sum(data) | |
# Initialize workflow storage. | |
workflow.init() | |
# Setup the workflow. | |
data = read_data.step(10) | |
preprocessed_data = preprocessing.step(data) | |
output = aggregate.step(preprocessed_data) | |
# Execute the workflow and print the result. | |
print(output.run()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment