Skip to content
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

Project1 #85

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,16 @@ cython_debug/
#.idea/

# Mac OS
.DS_Store
.DS_Store
.idea/.gitignore
.idea/corise-dagster.iml
.gitignore
.gitignore
.gitignore
.gitignore
.idea/modules.xml
.gitignore
.idea/inspectionProfiles/profiles_settings.xml
.idea/vcs.xml
dagster
*.db
22 changes: 15 additions & 7 deletions week_1/project/week_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,29 @@ def csv_helper(file_name: str) -> Iterator[Stock]:
yield Stock.from_list(row)


@op
def get_s3_data():
pass
@op(config_schema={"s3_key": String})
def get_s3_data(context) -> List[Stock]:
csv = csv_helper(context.op_config["s3_key"])
return [stock for stock in csv]


@op
def process_data():
pass
def process_data(context, data: List[Stock]) -> Aggregation:
agg_stock = Aggregation(date=datetime.today(), high=-1)
for stock in data:
next_agg = Aggregation(date=stock.date, high=stock.high)
if next_agg.high > agg_stock.high:
agg_stock = next_agg
return agg_stock


@op
def put_redis_data():
def put_redis_data(context, agg_data: Aggregation):
pass


@job
def week_1_pipeline():
pass
data = get_s3_data()
agg_data = process_data(data)
put_redis_data(agg_data)