https://prefect.io logo
#prefect-community
Title
# prefect-community
m

MasatoShima

06/29/2022, 9:42 AM
Hi. I’m trying Prefect Orion. I tried to start Prefect Server using the Prefect Python API, but got an error. Anyone have any idea what the cause might be? I would be glad to know. I’m using Prefect 2.0b7.
Copy code
from prefect.cli import orion

# Start Orion server.
asyncio.run(start_orion_server())

async def start_orion_server() -> None:
    await orion.start()

    print("Succeed starting Prefect Orion Server.")

    return
Copy code
Starting...
Traceback (most recent call last):
  File "/********/********/PyCharmProjects/********/workflows/initialize.py", line 233, in <module>
    initialize()
  File "/********/********/PyCharmProjects/********/workflows/initialize.py", line 69, in initialize
    asyncio.run(start_orion_server())
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/********/********/PyCharmProjects/********/workflows/initialize.py", line 196, in start_orion_server
    await orion.start()
  File "/********/********/Library/Caches/pypoetry/virtualenvs/********-py3.9/lib/python3.9/site-packages/prefect/cli/orion.py", line 120, in start
    await tg.start(
  File "/********/********/Library/Caches/pypoetry/virtualenvs/********-py3.9/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in start
    return await future
  File "/********/********/Library/Caches/pypoetry/virtualenvs/********-py3.9/lib/python3.9/site-packages/prefect/cli/_utilities.py", line 77, in open_process_and_stream_output
    process = await anyio.open_process(
  File "/********/********/Library/Caches/pypoetry/virtualenvs/********-py3.9/lib/python3.9/site-packages/anyio/_core/_subprocesses.py", line 127, in open_process
    return await get_asynclib().open_process(
  File "/********/********/Library/Caches/pypoetry/virtualenvs/********-py3.9/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1105, in open_process
    process = await asyncio.create_subprocess_exec(
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 789, in _start
    self._proc = subprocess.Popen(
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 1739, in _execute_child
    env_list.append(k + b'=' + os.fsencode(v))
  File "/********/********/.pyenv/versions/3.9.1/lib/python3.9/os.py", line 810, in fsencode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not OptionInfo
j

James Sopkin

06/29/2022, 2:08 PM
Hi Masato, the orion.start method requires for some parameters to be passed in such as host, port, scheduler etc, otherwise default values specified in settings will be used
I think it's expecting one of those parameters but is only receiving an
OptionInfo
object
m

MasatoShima

06/30/2022, 5:19 PM
Hi, James. Thank you very much for your answer! I was able to resolve the error successfully. Your advice helped me a lot.
10 Views