In Prefect 2.0, Is there any option via config to ...
# ask-community
x
In Prefect 2.0, Is there any option via config to change the default port number 4200?
a
Yes, you can set an env variable before starting Orion:
Copy code
export PREFECT_ORION_API_PORT=4242
z
prefect orion start
also takes a
--port
option. I do not believe the UI supports alternative ports yet though.
upvote 1
x
Thank you Anna and Michael. When I make the port change in .prefect/config.toml the "prefect orion start " command is not taking those changes. Do you know what am I missing.
z
Orion does not respect the
config.toml
yet.
x
Thank you Michael. If I change the port number from 4200 to 5200, how does the agent know which port the server is running. I deployed and executed few runs I see that status in the agent command line, but I don't see those flows and deployments in the browser UI.
z
You’ll need to set
PREFECT_ORION_HOST
on the agent to the path that the api is hosted on e.g.
<http://localhost:5200/api>
I don’t think the UI is going to work with a changed port though.
x
Since the root account using prefect 1.0 with existing default port numbers I am using CONDA virtual env and deployed prefect 2.0, but I can't run it due to port conflicts.
let me try with PREFECT_ORION_HOST
Now the agent is listening to 5200/api and when I deploy and run I see changes in the command line, but I don't see those flows and deployments in the browser UI
how can I see my flows and tasks in UI?
Can I make changes in the settings.py to make it work?
z
As I mentioned, the UI does not support a changed API port yet. It’s hard-coded on this line https://github.com/PrefectHQ/prefect/blob/orion/orion-ui/src/utilities/api.ts#L5
You’d need to install from the source code, modify that line, and run
prefect dev build-ui
x
ok, let me try. Thanks Michael.
z
Yep! We’re designing a way to configure it at runtime right now but it’s not quite ready yet 🙂
x
which code takes the environment variable or from settings.py while starting prefect orion server? We can apply the same logic to this UI code.
z
The UI code is built statically so it can’t retrieve a runtime variable yet
x
I got the source code and installed. Just checking. after I make change in api.ts every time, do I need to install again, or just I need to restart prefect orion? I believe the former.
by installing the dev code, I can't even see default UI screens like the tabs like flows, tasks, etc. I get {"detail":"Not Found"}, even before I make any changes to the code.
z
Yeah the UI needs to be built into static files for the Python library to serve
prefect dev build-ui
will resolve the “Not found”
You’ll need to rebuild the UI each time you make a change to the type script source
prefect dev start
will host the UI directly from the type script (available at a different port) if you want to test your changes without rebuilding manually
x
thank you, Michael. Let me try.
I can run the UI now. I can deploy and execute the flows and tasks in command line. I do see that activity in Lateness section of the UI, but I don't see the Flows, Deployments in the UI for some reason. I believe when I run prefect orion start, it starts both server and agent (I do see that in the result screen), I don't need to start the agent separately. But for some reason, the deployed tasks are not shown in the UI.
Do I need to build and run any other stuff?
~/.prefect/orion.db is being updated whenever I deploy. I see change in the timestamp.
Do I need to flush and recreate the db?
Also, how can I get the Radar UI integration?
I see the records in orion.db on the required tables e.g. flow. But the UI is not reading it from the db.
a
Do I need to flush and recreate the db?
If you don’t see your flows and flow runs in the UI, then you’re correct, running “prefect orion reset-db” may help to clean the DB state and start from scratch
z
Have you run the deployment?
Your flow/deployment may not appear in the dashboard without any flow runs
Dedicated deployment/flow pages are coming soon.
x
If I run with localhost I can see the my created/executed flows in UI. But if I use different port number or alias host name, the tasks and flows are created in SQLite db when I run it. But, not reflecting in the UI.
Yes I ran the deployment to create and run my flow.
I believe the SQLite URL is not setup correctly for the UI to read when I use different port number or alias host name. Is there any code where I can enforce it similar to api.ts?
Probably I need to make changes in settings.py. Please confirm.
z
The UI hits the API which reads from the DB
It sounds like the UI isn’t hitting the correct API still?
x
if I use 127.0.0.1 with dev build the UI works ok.
but only problem arises when I use different port or alias host
any suggestion to address it?
Also the prefect orion UI is very slow, I am not sure the APIs are taking more time even for simple flows and tasks. Or it is due to DEV build. Can I create a PROD build from the source code and make it go faster.
z
You’re working with development builds / trying a pattern that we don’t support yet. I can’t really speculate as it what’s going on with your connection.
The UI shouldn’t be slow though, I’m not sure what’s going on there.
x
Thanks Michael. QQ, How can I start Prefect Orion using authentication? Also, How to force the user to login while accessing the UI?
z
We don’t have any authentication yet and like Prefect Server I do not think there are plans to add it to the OSS offering due to the complexity involved in deploying secure auth.
x
2 cents. For many firms, security is very important since multiple teams can be part of the same server and all should be separated securely with high level of privacy. I think for now it is a weakest point for Prefect 2.0 at this time. We need to consider adding it. Since Workflow automation involves data and workflow security is a key even within the teams of the same firm.
z
Thanks for the feedback 🙂 I’ve shared this with the team.
109 Views