Trying again here, deployments showing in the UI, ...
# ask-community
a
Trying again here, deployments showing in the UI, but when I
select * from deployment
I get no results. Anyone see this before? Basic
prefect server start
on a machine with a sqlite db at
~/.prefect/prefect.db
1
j
It's likely you're not connected to the same db your server is connected to if you can see results in the UI but not in the database directly
a
That’s my suspicion, but I’m having a hard time figuring out the difference. My PREFECT_API_DATABASE_CONNECTION_URL is set to
sqlite+aiosqlite:////~/.prefect/prefect.db
so that’s where I thought the server would be connecting. Which is the db I’m querying manually. Any suggestions on how to investigate further?
j
What are you using to view?
I would try it like
~/.prefect/prefect.db
or even with the full path and exclude the dialect (
sqlite+aiosqlite
)
a
I am just manually inspecting the db with
sqlite3 ~/.prefect/prefect.db
. I can see all of the tables, but most are empty.
alembic_version
returns a commit, but selecting from deployment, flow, flow_run give no results
j
you might have an extra slash in
PREFECT_API_DATABASE_***
setting
also are you setting that manually or you're just using the default?
a
Hmm I’m just using the default
j
did you set an env variable at all? It can override the prefect settings
a
An env var to override a prefect env var? Or potentially some other env var that just exists on my machine? The machine is a linux image (AMI 2). My steps were essentially:
Copy code
prefect server start --port 4201
prefect config set PREFECT_API_URL="<http://127.0.0.1:4201/api>"
prefect agent start --pool default-agent-pool
Deployment.build_from_flow() # many of these
Deployment.apply() # ^^ all of these
I run this in a script. Looking to see if that sets any env vars that would be relevant
j
doing something like
export PREFECT_API_DATABASE_CONNECTION_URL="xxx"
will override any defaults or even
prefect config set PREFECT_API_DATABASE_CONNECTION_URL="xxx"
a
Yeah not messing with those at all 😕. The only thing non-default is port 4201, and setting the PREFECT_API_URL. Do you think the extra slash in
sqlite+aiosqlite:////~/.prefect/prefect.db
is causing an issue?
sqlite3 /~/.prefect/prefect.db
gives an error
https://docs.sqlalchemy.org/en/20/core/engines.html#sqlite That url seems okay. Is there any other way to see what db session / connection is being used by the UI?
j
Can you stop your server and in the same terminal window run
prefect deployment ls
and then if you see deployments there run:
Copy code
prefect config view --show-secrets --show-sources --show-defaults
a
prefect deployment ls
also returns nothing when the server is going
This is why I’m somewhat concerned. I stopped the server, and now when I start again and go to the UI, nothing is there, and the database is still empty, etc
j
If you run the prefect config command above what's your value for
PREFECT_API_DATABASE_CONNECTION_URL
a
With the server stopped, it is
None
But, with the server stopped,
ls
yields no results
(same as when the server was running previously)
Sorry, the server was still up actually. With the server stopped,
ls
errors since it can’t reach the api. The config value still comes through as
='None' (from defaults)
. So it was also ‘None’ with the server on? I got the connection url by entering a python shell and printing
PREFECT_API_DATABASE_CONNECTION_URL.value()
to get the sqlite+…
Still no luck. I did the same install on a separate machine (same type), and I see things in the UI, but there is NO .prefect directory at all, and no prefect.db anywhere on the filesystem. Yet I can see deployments and flow runs in the UI
Welp, I actually just figured it out! There is a prefect.db, it is at
/root/.prefect/prefect.db
. I guess my install script was running as root whereas I thought it was running as a user. I guess I stopped the server and restarted with the user so
~
expanded to
/user/
rather than
/root/
. SSH on EMR is fun.. Anyways appreciate the help, I know these issues are basically impossible without a much fuller picture of what’s going on
🙌 1
j
Not sure I did much but glad you were able to figure it out!
a
You certainly asked the right questions, which I ultimately gave the wrong answers to! I’m still not really sure how I created the confounding /user/ prefect.dbs in the first place.. Thanks again