https://prefect.io logo
Title
s

Surawut Jirasaktavee

07/23/2022, 1:46 PM
Hi, I need help. I got the below error since I ran the command
prefect storage ls
or
prefect storage create
. How can I solve this?
โœ… 1
a

Anna Geller

07/23/2022, 2:21 PM
Could you please move your code blocks into the thread?
๐Ÿ™ 1
We want to keep the main channel clean
๐Ÿ™ 1
Prefect storage has been deprecated in favor of filesystems - could you check the latest announcements in the #announcements channel?
Let me know if after reading this something still is not clear
s

Surawut Jirasaktavee

07/23/2022, 2:28 PM
(course-mlops-zoomcamp) :~/Github/MLOps/course-mlops-zoomcamp/03-orchestration main  prefect storage ls
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
    await get_running_loop().create_connection(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('::1', 80, 0, 0)
----------------------------
Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
    await get_running_loop().create_connection(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('127.0.0.1', 80)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
    raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
    stream = await self._connect(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
    return await self._backend.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/cli/_utilities.py", line 44, in wrapper
    return fn(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 122, in wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/utilities/asyncio.py", line 69, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/cli/storage.py", line 177, in ls
    json_blocks = await client.read_blocks(block_spec_type="STORAGE", as_json=True)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/client.py", line 1030, in read_blocks
    response = await <http://self._client.post|self._client.post>(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1842, in post
    return await self.request(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/client.py", line 212, in send
    response = await super().send(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1614, in send
    response = await self._send_handling_auth(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1716, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
An exception occurred.
I got the above error once I have remote Prefect to AWS. Then I change to my local and I can use the command to create the S3 storage and once I change to remote on AWS I got this error.
(course-mlops-zoomcamp)  ๐Ÿ‡น๐Ÿ‡ญ  ๎‚ฐ ~/Github/MLOps/course-mlops-zoomcamp/03-orchestration ๎‚ฐ ๎‚  main ยฑ ๎‚ฐ prefect config view
PREFECT_PROFILE='default'
PREFECT_API_URL='<http://54.183.252.17>:port/api' (from profile)                                                                            oy.py
Loading deployment specifications from python script at 'prefect_deploy.py'...
Script at 'prefect_deploy.py' encountered an exception
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in 
try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in 
connect_tcp
    await get_running_loop().create_connection(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('::1', 80, 0, 0)
----------------------------
Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in 
try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in 
connect_tcp
    await get_running_loop().create_connection(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('127.0.0.1', 80)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in 
map_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in 
connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 222, in 
connect_tcp
    raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in 
map_httpcore_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in 
handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, 
in handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, 
in handle_async_request
    response = await connection.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in 
handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in 
handle_async_request
    stream = await self._connect(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in 
_connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in 
connect_tcp
    return await self._backend.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in 
connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in 
map_exceptions
    raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/client.py", line 329, in 
api_healthcheck
    await self._client.get("/health")
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1751, in get
    return await self.request(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/client.py", line 212, in send
    response = await super().send(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1614, in send
    response = await self._send_handling_auth(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1642, in 
_send_handling_auth
    response = await self._send_handling_redirects(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1679, in 
_send_handling_redirects
    response = await self._send_single_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_client.py", line 1716, in 
_send_single_request
    response = await transport.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in 
handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in 
map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/Github/MLOps/course-mlops-zoomcamp/03-orchestration/prefect_deploy.py", line 200, in <module>
    main()
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/flows.py", line 319, in __call__
    return enter_flow_run_engine_from_flow_call(self, parameters)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/engine.py", line 107, in 
enter_flow_run_engine_from_flow_call
    return portal.call(begin_run)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/from_thread.py", line 283, in call
    return cast(T_Retval, self.start_task_soon(func, *args).result())
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/anyio/from_thread.py", line 219, in _call_func
    retval = await retval
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/client.py", line 95, in 
with_injected_client
    return await fn(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3.9/site-packages/prefect/engine.py", line 144, in 
create_then_begin_flow_run
    raise RuntimeError(
RuntimeError: Cannot create flow run. Failed to reach API at http:/api/.

Failed to load specifications from 'prefect_deploy.py'
Thatโ€™s the same issue, right?
a

Anna Geller

07/23/2022, 6:15 PM
yes, as I mentioned, you would need to switch to remote file systems instead of storage blocks or default storage
๐Ÿ‘ 1
s

Surawut Jirasaktavee

07/24/2022, 2:32 PM
Hi, I have followed what you mentioned with the storage and deployment way with this:
aws_s3_file_packager = FilePackager(filesystem=RemoteFileSystem(
    basepath="<s3://prefect-artifacts-prem/artifacts/>",
    settings={
        "key": "access_key",
        "secret": "secret_access_key",
    }
))

Deployment(
    flow=FlowScript(path="./prefect_deploy.py", name="main"),
    name="model_training",
    schedule=IntervalSchedule(interval=timedelta(minutes=5)),
    flow_runner=SubprocessFlowRunner(),
    packager=aws_s3_file_packager,
    tags=["test module3"]
)
It seem to be work at first but I got the error below about the connection.
(course-mlops-zoomcamp)  ๐Ÿ‡น๐Ÿ‡ญ  ๎‚ฐ ~/Github/MLOps/course-mlops-zoomcamp/03-orchestration ๎‚ฐ ๎‚  main ยฑ ๎‚ฐ prefect deployment create prefect_deploy.py 
Loading deployments from python script at 'prefect_deploy.py'...
Retrieving flow from script at 'prefect_deploy.py'...
Packaging flow for deployment 'main/model_training'...
Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, 
local_address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
    await get_running_loop().create_connection(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 61] Connect call failed ('13.52.76.201', 
4200)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/anyio/_core/_sockets.py", line 222, in connect_tcp
    raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_transports/default.py", line 60, in 
map_httpcore_exceptions
    yield
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_transports/default.py", line 353, in 
handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_async/connection_pool.py", line 253, in 
handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_async/connection_pool.py", line 237, in 
handle_async_request
    response = await connection.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_async/connection.py", line 86, in 
handle_async_request
    raise exc
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_async/connection.py", line 63, in 
handle_async_request
    stream = await self._connect(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
    return await self._backend.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/cli/deployment.py", line 288, in create
    await _create_deployment(deployment, client=client)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/cli/deployment.py", line 336, in 
_create_deployment
    manifest = await _deployment_to_manifest(deployment)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/cli/deployment.py", line 332, in 
_deployment_to_manifest
    return await deployment.packager.package(flow)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/client.py", line 107, in with_injected_client
    return await fn(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/packaging/file.py", line 55, in package
    or await self.filesystem._save(is_anonymous=True)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/blocks/core.py", line 558, in _save
    await self.register_type_and_schema(client=client)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/blocks/core.py", line 503, in 
register_type_and_schema
    block_type = await client.read_block_type_by_name(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/client.py", line 1089, in read_block_type_by_name
    response = await self._client.get(f"/block_types/name/{name}")
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1751, in get
    return await self.request(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, 
follow_redirects=follow_redirects)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/prefect/client.py", line 258, in send
    await super().send(*args, **kwargs)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1614, in send
    response = await self._send_handling_auth(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_client.py", line 1716, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_transports/default.py", line 353, in 
handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/Users/premsurawut/anaconda3/envs/course-mlops-zoomcamp/lib/python3
.9/site-packages/httpx/_transports/default.py", line 77, in 
map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

Failed to create deployment!
Failed to create 1 out of 1 deployments.
a

Anna Geller

07/24/2022, 2:59 PM
if you are on latest, flow runners changed to infrastructure and this is also not a final state yet https://discourse.prefect.io/t/prefect-2-0b12-removes-flow-runners-in-favor-of-more-flexible-infrastructure-blocks/1232 I'd recommend waiting until Wednesday for a stable release
๐Ÿ™Œ 1
s

Surawut Jirasaktavee

07/24/2022, 3:38 PM
okay, Thank you, I will wait for Wednesday and try again with the new patch.
๐Ÿ™Œ 1
@Anna Geller For now which Prefect version I should use?
I use Prefect 2.0a13 now. I have read the new release about the deployment. but when I run the prefect deployment to show the command I donโ€™t see
prefect deployment build
&
prefect deployment apply
like in the docs.
a

Anna Geller

07/30/2022, 7:10 PM
it depends, ideally use the latest which is now 2.0.1
๐Ÿ™Œ 1