Skip to content

⚙️ FEATURE-#22: Refactor template execution contract around dotflow start --workflow factory#23

Open
FernandoCelmer wants to merge 45 commits into
masterfrom
feature/22
Open

⚙️ FEATURE-#22: Refactor template execution contract around dotflow start --workflow factory#23
FernandoCelmer wants to merge 45 commits into
masterfrom
feature/22

Conversation

@FernandoCelmer

Copy link
Copy Markdown
Member

Summary

Unify every cloud platform template around a single execution contract built on dotflow start --workflow <module>.workflow:main. Fixes silent bugs in execution_mode (was dead config), double scheduling when scheduler=cron combined with externally-scheduled clouds, and mixed-stale entrypoints across Dockerfiles/handlers. Adds a new dotflow-cloud platform (README-only), wires EXECUTION_MODE through the post-gen hook, and bumps the generated project's dotflow pin to 1.0.0.dev2.

Changes by layer

Cookiecutter / hook:

  • cookiecutter.json — add dotflow-cloud to cloud choices.
  • hooks/post_gen_project.py — expose EXECUTION_MODE placeholder.

Generated project ({{cookiecutter.project_name}}/):

  • pyproject.toml — bump pin to 1.0.0.dev2; Jinja override forces scheduler="none" for clouds that schedule externally.
  • {{cookiecutter.module_name}}/workflow.pymain() is now a factory; adds internal workflow.start(mode=..., resume=...) only for Lambda/alibaba clouds that need it; SchedulerCron + [scheduler] extra dropped for externally-scheduled clouds.
  • README.md — local run instruction updated to dotflow start --workflow ...:main --mode ....

Container-style clouds (13 platforms):

  • Dockerfile/Procfile/heroku.yml/fly.toml/railway.json/github-actions dotflow.yml all use dotflow start --workflow {{MODULE_NAME}}.workflow:main --mode {{EXECUTION_MODE}}.

Lambda-compatible clouds (7 platforms):

  • handler.py simplified to main() (start is internal to main() via Jinja).
  • Dockerfile CMD stays on platform contract (handler.handler for Lambda, python -c ENTRYPOINT for alibaba-fc).

New dotflow-cloud platform:

  • Added cloud/dotflow-cloud/README.md + registry entry with files: ["README.md"].

Docs (14 READMEs):

  • "Important" section updated across all platforms to describe the new contract.

Scheduled-cloud override

workflow.py and pyproject.toml both use:

{%- set scheduled_clouds = ["dotflow-cloud", "lambda-scheduled", "ecs-scheduled", "cloud-run-scheduled", "alibaba-fc-scheduled", "github-actions"] -%}
{%- set scheduler = "none" if cookiecutter.cloud in scheduled_clouds else cookiecutter.scheduler -%}

Prevents double-scheduling when the user picks scheduler=cron together with an externally-scheduled cloud.

Known gap (tracked upstream)

checkpoint=yes combined with a CLI-based cloud still silently does nothing because dotflow start CLI is missing a --resume flag. Tracked in dotflow-io/dotflow#267. Once shipped, container-style Dockerfiles can emit --resume conditionally.

Test plan

  • Manual grep: no python -m ... workflow left, no result = main() left, single CMD shape per cloud family.
  • JSON validation: cloud/registry.json parses.
  • End-to-end: cookiecutter gh:dotflow-io/templates with each cloud option and inspect generated files (pending release).

Closes #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor template execution contract around dotflow start --workflow factory

1 participant