Garret Cook
01/22/2021, 4:57 PMnicholas
01/22/2021, 5:00 PMGarret Cook
01/22/2021, 5:00 PMnicholas
01/22/2021, 5:01 PMGarret Cook
01/22/2021, 5:01 PMnicholas
01/22/2021, 5:01 PMprefect backend server
before attempting to start your agent?Garret Cook
01/22/2021, 5:02 PMnicholas
01/22/2021, 5:03 PMcurl <http://localhost:4200/graphql>
and see what's returned?Garret Cook
01/22/2021, 5:04 PMGET /graphql HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:4200
Accept: /< HTTP/1.1 400 Bad Request < X-Powered-By: Express < Access-Control-Allow-Origin: * < Content-Type: text/html; charset=utf-8 < Content-Length: 18 < ETag: W/“12-7JEJwpG8g89ii7CR/6hhfN27Q+k” < Date: Fri, 22 Jan 2021 17:03:45 GMT < Connection: keep-alive < Keep-Alive: timeout=5 < * Connection #0 to host localhost left intact GET query missing.
nicholas
01/22/2021, 5:07 PMGarret Cook
01/22/2021, 5:07 PMnicholas
01/22/2021, 5:12 PMecho "from prefect.utilities.docker_util import get_docker_ip\nprint(get_docker_ip())" > docker_ip.py && python docker_ip.py
Garret Cook
01/22/2021, 5:14 PM[root@prefect ~]# cat docker_ip.py
from prefect.utilities.docker_util import get_docker_ip
print(get_docker_ip())
[root@prefect ~]# python3.6 docker_ip.py
172.17.0.1
[root@prefect ~]#
nicholas
01/22/2021, 5:15 PMfirewalld
- you're able to communicate with the API over http from a variety of sources but not through the docker host. You'll need to allow container to container communication to enable this, I think, which you can do with firewall-cmd --zone=public --add-masquerade --permanent && firewall-cmd --reload
Garret Cook
01/22/2021, 5:22 PMnicholas
01/22/2021, 5:28 PMGarret Cook
01/22/2021, 5:29 PM[root@prefect ~]# prefect agent docker start
____ __ _ _ _
| _ \ _ __ ___ / _| ___ ___| |_ / \ __ _ ___ _ __ | |_
| |_) | '__/ _ \ |_ / _ \/ __| __| / _ \ / _
|/ _ \ '_ \| __|`
| __/| | | __/ _| __/ (__| |_ / ___ \ (_| | __/ | | | |_
|_| |_| \___|_| \___|\___|\__| /_/ \_\__, |\___|_| |_|\__|
|___/
[2021-01-22 17:27:21,044] INFO - agent | Starting DockerAgent with labels []
[2021-01-22 17:27:21,045] INFO - agent | Agent documentation can be found at <https://docs.prefect.io/orchestration/>
[2021-01-22 17:27:21,045] INFO - agent | Agent connecting to the Prefect API at <http://localhost:4200>
[2021-01-22 17:27:21,079] INFO - agent | Waiting for flow runs...
[2021-01-22 17:27:21,316] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-01-22 17:27:21,513] INFO - agent | Deploying flow run 2d740d95-feb3-4ae9-b002-c4581595abf8
[2021-01-22 17:27:21,518] INFO - agent | Pulling image prefecthq/prefect:0.14.3...
[2021-01-22 17:27:24,245] INFO - agent | Successfully pulled image prefecthq/prefect:0.14.3...
[2021-01-22 17:28:08,008] INFO - agent | Found 1 flow run(s) to submit for execution.
[2021-01-22 17:28:08,175] INFO - agent | Deploying flow run 980ddf94-76c8-4e90-8219-59c80a3b30e5
[2021-01-22 17:28:08,181] INFO - agent | Pulling image prefecthq/prefect:0.14.3...
[2021-01-22 17:28:08,933] INFO - agent | Successfully pulled image prefecthq/prefect:0.14.3...
nicholas
01/22/2021, 5:30 PMGarret Cook
01/22/2021, 5:30 PMnicholas
01/22/2021, 5:31 PMGarret Cook
01/22/2021, 5:32 PM[root@prefect production-flows]# cat task.py
import prefect
from prefect.run_configs.docker import DockerRun
from prefect import task, Flow
@task
def say_hello():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("Hello, Cloud!")
with Flow("hello-flow") as flow:
say_hello()
flow.run_config = DockerRun(
#env={"SOME_VAR": "VALUE"},
#image="example/image-name:with-tag"
)
# builds the Docker image and pushes Flow metadata to the Prefect Cloud database
#flow.deploy(project_name="Backups")
flow.register(project_name="Backups")
nicholas
01/22/2021, 6:27 PMRunning
state?Garret Cook
01/22/2021, 6:30 PMnicholas
01/22/2021, 6:33 PMDockerRun
- you'll either need to specify an image for that OR add docker storage to the flow:
from prefect.storage import Docker
flow.storage = Docker()
Garret Cook
01/22/2021, 6:34 PMnicholas
01/22/2021, 6:34 PMGarret Cook
01/22/2021, 6:34 PM[2021-01-22 17:43:53,340] INFO - agent | Pulling image prefecthq/prefect:0.14.3...
nicholas
01/22/2021, 6:36 PMGarret Cook
01/22/2021, 7:42 PMprefect agent docker start --show-flow-logs
nicholas
01/22/2021, 8:23 PMGarret Cook
01/22/2021, 8:24 PMurllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='host.docker.internal', port=4200): Max retries exceeded with url: /graphql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0166b2a908>: Failed to establish a new connection: [Errno 113] No route to host',))
nicholas
01/22/2021, 8:36 PMGarret Cook
01/22/2021, 8:36 PMnicholas
01/22/2021, 8:37 PMGarret Cook
01/22/2021, 8:37 PMnicholas
01/22/2021, 8:37 PMGarret Cook
01/22/2021, 8:38 PM