Port a three-stage date-range scheduling pipeline to a Modal function call graph.
harbor run -t vmax-modal/modal-port-v1-patched-date-schedule-graph
harbor download vmax-modal/modal-port-v1-patched-date-schedule-graph
original_workflow.py implements date_schedule_pipeline(case) as three stages:
original_workflow.py
date_schedule_pipeline(case)
Stage 1 — enumerate: generate all calendar dates from start to end (exclusive) as datetime64[D].
start
end
datetime64[D]
Stage 2 — filter: keep only business days using np.is_busday.
np.is_busday
Stage 3 — intersect: remove any dates that appear in the holidays list, then compute final schedule statistics.
holidays
from original_workflow import date_schedule_pipeline result = date_schedule_pipeline({ "start": "2024-01-01", "end": "2024-04-01", "holidays": ["2024-01-15", "2024-02-19"] }) # {"schedule_days": list[str], "n_total": int, "n_business": int, "n_after_holidays": int}
Port to Modal as three cooperating remote functions: enumerate, filter, intersect+stats. The orchestrator chains them in sequence.
Write your solution to /app/solution/modal_app.py defining:
/app/solution/modal_app.py
app
run_case
run_caseremote invocation (case)
{"start": str, "end": str, "holidays": list[str]}
{"schedule_days": list[str], "n_total": int, "n_business": int, "n_after_holidays": int}
Expose the workflow as a single Modal remote function: define run_case as an @app.function so the harness can invoke it with run_case.remote(case).
@app.function
run_case.remote(case)
The solution must also use: