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

Universal Deploy #1819

Merged
merged 100 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
7d9652c
Still working on it
cicdw Nov 2, 2019
4055987
Remove client method that i will no longer use
cicdw Nov 2, 2019
94c2386
Merge branch 'local-labels' into deploy-2.0
cicdw Nov 3, 2019
3ec48c0
Add working run_agent command for running cloud flows locally
cicdw Nov 3, 2019
8adf268
Add a small docstring about the run_agent method
cicdw Nov 3, 2019
1afc970
Merge branch 'master' into deploy-2.0
cicdw Nov 4, 2019
8dcf31b
Merge branch 'master' into deploy-2.0
cicdw Nov 5, 2019
b82f14a
Begin reworking local agent
cicdw Nov 5, 2019
34e3c0d
Remove unused local code
cicdw Nov 5, 2019
7c8a670
Merge branch 'master' into deploy-2.0
cicdw Nov 7, 2019
fe690e8
Add missed docker files
cicdw Nov 7, 2019
1603a0d
Rename LocalAgent DockerAgent
cicdw Nov 7, 2019
55f8cd8
Rename Local Agent to Docker Agent in docs
joshmeek Nov 8, 2019
46fd6ae
Implement Docker Agent tests and remove all references of runner_toke…
joshmeek Nov 8, 2019
e8f2e9d
Add an untested version of the local agent
cicdw Nov 10, 2019
e21bddb
Add working truly local agent
cicdw Nov 10, 2019
53d4cd2
Always include 'local' label on local agents
cicdw Nov 10, 2019
f545d7c
Reset default logging level for agents
cicdw Nov 10, 2019
87b1b3e
Move local agent logic
cicdw Nov 11, 2019
665b5bd
Update references to old Local Agent in docs
joshmeek Nov 12, 2019
54e829c
Add doc for Local Agent
joshmeek Nov 12, 2019
497c4f8
Update Local Agent link in docstring
joshmeek Nov 12, 2019
52b2d33
Add note to Local Agent doc about multiple labels for local Flows
joshmeek Nov 13, 2019
b7d9dac
Set PYTHONPATH to preserve imports
cicdw Nov 14, 2019
55d9753
Slightly improved labeling
cicdw Nov 14, 2019
658450d
Add import paths keyword to local agent
cicdw Nov 14, 2019
9a54ddb
Add supervisor to requirements
cicdw Nov 14, 2019
b4affa7
Always conert agent labels to list
cicdw Nov 14, 2019
02d4db4
Set flow run state to Failed if deploy error occurs in local agent
cicdw Nov 14, 2019
b7b2686
Version fix
cicdw Nov 14, 2019
823167d
Add supervisor installation
cicdw Nov 15, 2019
cc0a403
Remove API option from CLI install for local agents
cicdw Nov 15, 2019
e67154e
Get local paths working on Mac
cicdw Nov 15, 2019
bbedda4
Fix formatting of cli options
cicdw Nov 17, 2019
c8a2b6e
Resolve merge conflicts with master
cicdw Nov 17, 2019
2e99cb8
Finish resolving merge conflicts
cicdw Nov 17, 2019
06d75d4
Remove unnecessary supervisor comment
cicdw Nov 17, 2019
3ee2de7
Fix agent CLI commands
cicdw Nov 17, 2019
94942da
Update help documentation
cicdw Nov 17, 2019
9096234
Add some more local agent polish
cicdw Nov 17, 2019
7c6ed25
Touch up type hints
cicdw Nov 17, 2019
8533b25
Begin fixing tests
cicdw Nov 17, 2019
7196084
Fix a few more tests
cicdw Nov 17, 2019
b4fcd9a
Stop providing auth token to subprocess environment
cicdw Nov 17, 2019
ac640b2
Change agent start default to local from docker
joshmeek Nov 18, 2019
106dd13
Remove default for agent install CLI command
joshmeek Nov 18, 2019
40fb697
Update CLI docstring
joshmeek Nov 18, 2019
873a178
Merge branch 'master' into deploy-2.1
cicdw Nov 22, 2019
3e8b550
Graceful retrieval of PWD
cicdw Nov 22, 2019
6f0e2a7
Reimplement agent runner token verification
joshmeek Nov 26, 2019
c6fb25f
Reimplement runner token pytest fixture
joshmeek Nov 26, 2019
b25c950
Refactor deploy -> register in core flow
joshmeek Dec 2, 2019
28e4dad
Update references of deploy to register
joshmeek Dec 2, 2019
042171d
Update client docstring
joshmeek Dec 2, 2019
eb6a73f
Add tests for new local agent
joshmeek Dec 2, 2019
1a9a113
Update agent cli tests for local agent
joshmeek Dec 2, 2019
fa6e661
Merge branch 'deploy-2.2' into register
joshmeek Dec 2, 2019
b337177
Update cloud doc structure
joshmeek Dec 2, 2019
9218884
correct agent start docs
Dec 2, 2019
a2b3e23
Add deprecation warning to flow.deploy
joshmeek Dec 3, 2019
2098ddf
Merge pull request #1789 from PrefectHQ/register
joshmeek Dec 3, 2019
a0d6ff1
Merge branch 'deploy-2.2' into deploy_docs
joshmeek Dec 3, 2019
b24238f
add local agent flow logging support
Dec 3, 2019
7ed22af
direct all logging to stdout (not stderr)
Dec 3, 2019
6cd9a38
Added documentation for user upstart with cloud
joshmeek Dec 4, 2019
9ef1837
add local agent heartbeat test
Dec 5, 2019
114f750
honor existing python path + fix pwd assumption
Dec 5, 2019
e79e2d5
install extras for testing in appveyor
Dec 5, 2019
1bef402
Building blocks of deployment documentation
joshmeek Dec 5, 2019
8acbf3d
Rearrange cloud docs and add templates for next steps
joshmeek Dec 8, 2019
95ff47c
Merge branch 'deploy_docs' into deploy-2.2
joshmeek Dec 8, 2019
dacb5a2
Added list of onboard docs to first Cloud page
joshmeek Dec 9, 2019
5446aee
Tweak documentation wording
zdhughes Dec 9, 2019
65e87ea
Add Cloud Tutorial docs
joshmeek Dec 10, 2019
131ae91
Resolve merge conflicts with master (I think)
cicdw Dec 10, 2019
591eef7
Tidy up so that docs can be served
cicdw Dec 10, 2019
f4a7bca
Add auto-labeling of flow environments based on storage type
cicdw Dec 10, 2019
9e26414
Add show_flow_logs to doc strings
cicdw Dec 10, 2019
1d784cd
Make auto-labels more specific
cicdw Dec 10, 2019
ec42cf4
Auto label the local agent with the new storage labels
cicdw Dec 10, 2019
8089f29
Fix tests caused by new autolabels on local agent
cicdw Dec 10, 2019
4e25362
Merge pull request #1817 from PrefectHQ/storage-auto-labels
cicdw Dec 10, 2019
ab1f3f1
Merge branch 'master' into deploy-2.2
cicdw Dec 10, 2019
866c5da
Skip graphviz test which fails on appveyor
cicdw Dec 10, 2019
8aec281
Merge branch 'master' into deploy-2.2
cicdw Dec 10, 2019
bbcdf1d
Move skipifs down to the execution submodule of tests
cicdw Dec 10, 2019
98a632c
Merge branch 'deploy-2.2' of https://github.com/PrefectHQ/prefect int…
cicdw Dec 10, 2019
35f0cc0
Import pytest
cicdw Dec 10, 2019
c308899
Remove unnecessary import of google cloud storage
cicdw Dec 10, 2019
4eaafee
Fix failing windows tests
cicdw Dec 10, 2019
e14bab7
Use pytestmark
cicdw Dec 10, 2019
83c9548
Remove path validation at deserialiation time for local storage
cicdw Dec 10, 2019
dda3513
Ensure agent labels are always a list
cicdw Dec 10, 2019
a477f1d
Add new storage classes to API documentation
cicdw Dec 10, 2019
89e2358
add show_flow_logs to run_agent fn
Dec 10, 2019
cbd71f0
Update CHANGELOG
joshmeek Dec 10, 2019
4233aef
Resolve merge conflicts
joshmeek Dec 10, 2019
9b96654
Update local agent doc to include new default labels
joshmeek Dec 10, 2019
5cf1238
Update storage options doc with notes about auto labels
joshmeek Dec 10, 2019
d0f3d39
Update storage class docstrings with notes about auto labels
joshmeek Dec 10, 2019
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- setup_remote_docker
- run:
name: Install prefect
command: pip install -e ".[dev]"
command: pip install -e ".[dev,test]"

- run:
name: Run documentation tests
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:

- run:
name: Install testing packages
command: pip install "pytest==5.0" pytest-cov pytest-env
command: pip install -r test-requirements.txt

- run:
name: Run tests
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:

- run:
name: Install testing packages
command: pip install "pytest>=4.3,<5.0" pytest-cov pytest-env
command: pip install -r test-requirements.txt

- run:
name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include src/prefect/_version.py
include src/prefect/_siginfo.py
include src/prefect/_sig29/*.txt
graft src/prefect/environments
graft src/prefect/agent
graft src/prefect/agent
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"

install:
- "%PYTHON%/Scripts/pip.exe install pytest==5.2.2"
- "%PYTHON%/Scripts/pip.exe install ."
- "%PYTHON%/Scripts/pip.exe install -r test-requirements.txt"
- "%PYTHON%/Scripts/pip.exe install .[all_extras]"

test_script:
- "%PYTHON%/Scripts/pytest . --skip-formatting"
4 changes: 0 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ black
graphviz >= 0.8, < 0.14
jinja2 >= 2.0, < 3.0
mypy >= 0.600, < 0.800
pytest >= 5.0, < 5.3.2
pytest-cov >= 2.6, < 3.0
pytest-env >= 0.6.0, < 0.7.0
pytest-xdist >= 1.23, < 2.0
Pygments >= 2.2, < 3.0
40 changes: 20 additions & 20 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ module.exports = {
ga: 'UA-115585378-1'
}
],
['vuepress-plugin-code-copy', true],
["vuepress-plugin-code-copy", true],
'vuepress-plugin-element-tabs',
[
'vuepress-plugin-selected-text-popup',
'vuepress-plugin-selected-text-popup',
{
github: true,
githubOwner: 'prefecthq',
Expand Down Expand Up @@ -71,8 +72,8 @@ module.exports = {
link: '/core/'
},
{
text: 'Prefect Cloud',
link: '/cloud/the-basics'
text: "Prefect Cloud",
link: "/cloud/dataflow"
},
{
text: 'API Reference',
Expand Down Expand Up @@ -155,15 +156,12 @@ module.exports = {
{
title: 'Welcome',
collapsable: false,
children: [
'the-basics',
'upandrunning',
'flow-deploy',
'dataflow',
'deployment',
'other-considerations',
'faq'
]
children: ["dataflow", "faq"]
},
{
title: "Tutorial",
collapsable: false,
children: ["tutorial/configure", "tutorial/first", "tutorial/multiple", "tutorial/docker", "tutorial/k8s", "tutorial/next-steps"]
},
{
title: 'Cloud Concepts',
Expand All @@ -174,12 +172,13 @@ module.exports = {
title: 'Cloud Execution',
collapsable: true,
children: [
'execution/overview',
'execution/remote_environment',
'execution/dask_k8s_environment',
'execution/k8s_job_environment',
'execution/fargate_task_environment',
'execution/custom_environment'
"execution/overview",
"execution/storage_options",
"execution/remote_environment",
"execution/dask_k8s_environment",
"execution/k8s_job_environment",
"execution/fargate_task_environment",
"execution/custom_environment",
]
},
{
Expand All @@ -188,14 +187,15 @@ module.exports = {
children: [
'agent/overview',
'agent/local',
'agent/docker',
'agent/kubernetes',
'agent/fargate'
]
},
{
title: 'Deployment Recipes',
collapsable: true,
children: getChildren('docs/cloud', 'recipes')
children: ["recipes/deployment", "recipes/configuring_storage", "recipes/multi_flow_storage", "recipes/k8s_dask", "recipes/k8s_docker_sidecar",]
}
],
'/core/': [
Expand Down
52 changes: 52 additions & 0 deletions docs/cloud/agent/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Docker Agent

The Docker Agent is designed to work in all environments with access to a Docker daemon. Docker agents are most commonly used on personal machines for testing flow run deployments, but the docker agent is by no means only useful for testing. In fact, it creates flow runs that interact with Prefect Cloud in the same way that it would on any other platform. This allows the Docker Agent to be a fully functioning method of executing flows in conjunction with Prefect Cloud.

[[toc]]

### Requirements

::: warning Docker Daemon
The Docker Agent requires an accessible Docker daemon. So if you are using this on your local machine make sure that you have Docker running. If Docker is not running, or the agent cannot access a daemon, it will notify users on start.
:::

### Usage

```
$ prefect agent start docker

____ __ _ _ _
| _ \ _ __ ___ / _| ___ ___| |_ / \ __ _ ___ _ __ | |_
| |_) | '__/ _ \ |_ / _ \/ __| __| / _ \ / _` |/ _ \ '_ \| __|
| __/| | | __/ _| __/ (__| |_ / ___ \ (_| | __/ | | | |_
|_| |_| \___|_| \___|\___|\__| /_/ \_\__, |\___|_| |_|\__|
|___/

2019-09-01 12:24:59,261 - agent - INFO - Starting DockerAgent
2019-09-01 12:24:59,261 - agent - INFO - Agent documentation can be found at https://docs.prefect.io/cloud/
2019-09-01 12:24:59,482 - agent - INFO - Agent successfully connected to Prefect Cloud
2019-09-01 12:24:59,482 - agent - INFO - Waiting for flow runs...
```

The Docker Agent can be started either through the Prefect CLI or by importing the `DockerAgent` class from the core library.

::: tip Tokens
There are a few ways in which you can specify a `RUNNER` API token:

- command argument `prefect agent start docker -t MY_TOKEN`
- environment variable `export PREFECT__CLOUD__AGENT__AUTH_TOKEN=MY_TOKEN`
- token will be used from `prefect.config.cloud.auth_token` if not provided from one of the two previous methods

:::

### Process

On start, the Docker Agent verifies that it can connect to a Docker daemon. The default daemon location is determined by your system. `npipe:////./pipe/docker_engine` for Windows and `unix://var/run/docker.sock` for Unix. A separate Docker daemon location can be provided either through `base_url` when instantiating a `DockerAgent` object or through `--base-url` on the CLI.

The Docker Agent periodically polls for new flow runs to execute. When a flow run is retrieved from Prefect Cloud, the agent confirms that the flow was registered with a Docker storage option and uses the connected Docker daemon to create a container and run the flow.

The agent will block on the process in between finding the flow run and submitting it for execution if it has to pull the flow's Docker image.

::: tip no-pull
The docker agent has an optional `--no-pull` flag where it will not attempt to pull the flow's Docker storage from a registry if desired. This is useful for cases in which a user may be testing the process completely dockerly without pushing the flow's Docker storage to a registry. Alternatively, if a flow's Docker storage does not have a `registry_url` specified then the Docker Agent will not attempt to pull the image.
:::
2 changes: 1 addition & 1 deletion docs/cloud/agent/fargate.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You are now ready to run some flows!

### Process

The Fargate Agent periodically polls for new flow runs to execute. When a flow run is retrieved from Prefect Cloud the agent checks to make sure that the flow was deployed with a Docker storage option. If so, the agent then creates a Task using the `storage` attribute of that flow, and runs `prefect execute cloud-flow`.
The Fargate Agent periodically polls for new flow runs to execute. When a flow run is retrieved from Prefect Cloud the agent checks to make sure that the flow was registered with a Docker storage option. If so, the agent then creates a Task using the `storage` attribute of that flow, and runs `prefect execute cloud-flow`.

If it is the first run of a particular flow then a Task Definition will be registered. Each new run of that flow will run using that same Task Definition and it will override some of the environment variables in order to specify which flow run is occurring.

Expand Down
16 changes: 11 additions & 5 deletions docs/cloud/agent/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,30 @@ The Prefect CLI provides commands for installing agents on their respective plat

```
$ prefect agent install --help
Usage: prefect agent install [OPTIONS] [NAME]
Usage: prefect agent install [OPTIONS] NAME

Install an agent. Outputs configuration text which can be used to install
on various platforms. The Prefect image version will default to your local
`prefect.__version__`

Arguments:
name TEXT The name of an agent to start (e.g. `kubernetes`)
Defaults to `kubernetes`
name TEXT The name of an agent to install (e.g. `kubernetes`, `local`)

Options:
--token, -t TEXT A Prefect Cloud API token
--label, -l TEXT Labels the agent will use to query for flow runs
Multiple values supported e.g. `-l label1 -l label2`

Kubernetes Agent Options:
--api, -a TEXT A Prefect Cloud API URL
--namespace, -n TEXT Agent namespace to launch workloads
--image-pull-secrets, -i TEXT Name of image pull secrets to use for workloads
--resource-manager Enable resource manager on install
--label, -l TEXT Labels the agent will use to query for flow runs
Multiple values supported e.g. `-l label1 -l label2`

Local Agent Options:
--import-path, -p TEXT Absolute import paths to provide to the local agent.
Multiple values supported e.g. `-p /root/my_scripts -p /utilities`
--show-flow-logs, -f Display logging output from flows run by the agent

Options:
-h, --help Show this message and exit.
Expand Down
Loading