@projectdecorator comes in.
step-functions createindependently, each deployment will overwrite the previous one.
@projectdecorator to address this need. The
@projectdecorator is used at the
FlowSpec-level to bind a Flow to a specific project. All flows with the same project name belong to the same project.
project_flow.py. Now you can run the flow as usual:
@projectdecorator exposes new project-related attributes,
is_productionin the current object which you can use to alter the behavior of the flow depending on the execution context. Besides the new attributes in current, the flow works exactly as before when executed outside AWS Step Functions.
@projectdecorator changes this behavior. Let's deploy ProjectFlow:
@projectdecorator adds a user-specific prefix in the workflow name: the workflow gets deployed with a name like
YOURNAMEis your user name.
step-functions createindependently, which results in three separate workflows on AWS Step Functions:
Flow('ProjectFlow').latest_runon AWS Step Functions, it is guaranteed to refer to a run that corresponds to its own isolated deployment. The deployments don't interfere with each other.
@projectdecorator exposes a new top-level command-line argument,
--productionthat denotes a production run or deployment. See what happens when you run ProjectFlow with
current.branch_namewill be set to prod and
current.is_productionis set to True. For instance, you could write results to a production table only if
example_project.prod.ProjectFlow. You will get a warning about missing production token if you are not authorized to deploy the flow to production.
test.better_version. You can deploy the custom branch to AWS Step Functions:
prod.better_version. You can deploy the custom branch to AWS Step Functions:
@projectdecorator makes available three classes of namespaces that will affect the behavior of
useris the default. It will deploy to a user-specific, private namespace. Use it for testing production deployments.
testdenotes custom branches that can be shared amongst multiple users. Use it for deploying experimental versions that can run in parallel with production. Deploy custom branches with
proddenotes the global production namespace. Use it for deploying the official production version of the project. Deploy to production with
--production. For multiple production variants, deploy custom branches with
--production --branch foo.
@projectwork best when your code is designed to respect these boundaries. For instance, when writing results to a table, you can use
current.branch_nameto choose the table to write to or you can disable writes outside production by checking