https://prefect.io logo
Title
d

Daniel

10/24/2022, 7:40 PM
Hello, I have just started going through Prefect 2.0 tutorials and I'm trying to access the ui. I changed the host address for orion to be 0.0.0.0 on a headless vm I'm using for development. I am connected to the host and port via my local machine's browser, however the ui is void of any content save for the headers of each page and the side navbar. I've run multiple flows as part of the tutorials and still nothing shows. The logs from on the command line show nothing out of the ordinary. Additionally, I can go through each of the pages linked in the navbar and see the headers and some UI components (like a blank dropdown menu), but when I click on the settings link, the page goes completely blank and when I go to any other page, it stays blank and an error pops up in the console until I refresh the page:
TypeError: Cannot read properties of null (reading 'parentNode')
    at parentNode (index.dae84138.js:4:48177)
    at <http://qw.se|qw.se> [as fn] (index.dae84138.js:4:33506)
    at qw.run (index.dae84138.js:1:5367)
    at U.E.update (index.dae84138.js:4:34233)
    at go (index.dae84138.js:4:664)
    at fM (index.dae84138.js:4:2296)
Finally, I am running my python scripts and have prefect==2.6.4 pip installed via a conda environment on my vm.
r

Ryan Peden

10/24/2022, 11:54 PM
Hi Daniel, I believe you'll need to do one of the following on the VM: • run
prefect config set PREFECT_ORION_UI_API_URL=<http://your-vm-IP/api>
• or, set the
PREFECT_ORION_UI_API_URL
to ``http://your-vm-IP/api` . If you're not running Orion on port 80, you'll need to add the port after the IP as well. Setting that should ensure the UI knows where to find the UI. By default it looks for the same address the server is started on.
b

Bebeto Nyamwamu

10/25/2022, 10:30 AM
Hello @Ryan Peden am not able to view the blocks
d

Daniel

10/25/2022, 11:43 AM
Thank you @Ryan Peden! That did it
b

Bebeto Nyamwamu

10/25/2022, 11:45 AM
Daniel is your blocks tab working?
d

Daniel

10/25/2022, 12:15 PM
yeah it is, @Bebeto Nyamwamu. The UI is fully functional it seems
b

Bebeto Nyamwamu

10/25/2022, 12:17 PM
Could you please help with my situation, all my tabs are empty unusual of a prefect installation?
Refer to the image above
r

Ryan Peden

10/25/2022, 12:20 PM
Bebeto, there was an issue with a bad service worker recently that can cause what you are seeing. I'll try to find a link to to Slack thread with instructions on how to clear it. I believe there's an button for it in the Application tab of Chrome's dev tools.
b

Bebeto Nyamwamu

10/25/2022, 12:22 PM
@Ryan Peden Please help with my concerns on this same thread
r

Ryan Peden

10/25/2022, 12:29 PM
@Bebeto Nyamwamu The fixes in this thread will likely fix the problem you are seeing: https://linen.prefect.io/t/3606147/question-about-deployments-amp-ui-everything-worked-till-ver
b

Bebeto Nyamwamu

10/25/2022, 1:36 PM
It is not helping and I am running prefect on gcp
r

Ryan Peden

10/25/2022, 1:43 PM
Okay - and just to confirm, you set the
PREFECT_ORION_UI_API_URL
environment variable on the GCP server where Prefect is running, and the IP address or hostname in it matches the address on which you are accessing Prefect in your browser?
b

Bebeto Nyamwamu

10/25/2022, 1:49 PM
PREFECT_ORION_UI_API_URL='http://gcp-public-ip:4200/api'
thats the way I have it
r

Ryan Peden

10/25/2022, 2:00 PM
Okay, that looks correct. A couple more questions: • Do you see any error messages in the console of your browser's development tools? • If you load
<http://gcp-public-ip:4200/api>
in your browser, do you see anything? There's nothing at that route, so it should return the following JSON:
{"detail":"Not Found"}
. I just want to make sure the browser is able to load API routes like it should.
b

Bebeto Nyamwamu

10/25/2022, 2:17 PM
Thanks. It is working finally. I had messed up the PREFECT_ORION_API_HOST
Another question is how do I provide authentication to a gcp bucket when building a deployment
r

Ryan Peden

10/25/2022, 3:17 PM
I'm happy to hear you got it working! For bucket authentication, I believe you can use the service account keyfile in the GCS block. If you don't yet have a keyfile, see this section of the GCP docs.
b

Bebeto Nyamwamu

10/25/2022, 3:35 PM
Thank you @Ryan Peden you are a life saver
another concern: is it possible to have remote location here: PREFECT_LOCAL_STORAGE_PATH
r

Ryan Peden

10/25/2022, 4:50 PM
You set up a remote storage block and use it as result storage for your flows using the
result_storage
parameter in the flow decorator. This stores your flow and task results remotely instead of on the filesystem at PREFECT_LOCAL_STORAGE_PATH. For example:
# assumes you have a writable storage block (S3, Azure blob, etc.) 
# named 'my-remote-storage'

@flow(result_storage="my-flow-storage")
def my_flow(message):
    print(message)
    return "This will get saved in my-storage-block"
If you've already loaded a storage block, you can also use it directly instead of using its name:
storage_block = S3.load("my-flow-storage")

@flow(result_storage=storage_block)
def my_flow(message):
    print(message)
    return "This will get saved in my-storage-block."
By default, subflows and tasks will use their parent flow's result storage but if you need to, you can specify different storage for them. For example:
@task(result_storage="my-task-storage")
def my_task(message):
    print(f"Task message: {message}")
    return "This will always get saved in my-task-storage-block."

@task
def my_other_task(message):
    print(f"Task message: {message}")
    # inherits result_storage from the flow that called the task
    # because we didn't provide one
    return """
        This will get saved in my-subflow-storage or my-flow-storage,    
        depending on which flow calls it.
    """

@flow(result_storage="my-subflow-storage")
def my_subflow(message):
    print(f"Subflow message: {message}")
    my_task(message) # results stored in my-flow-storage
    return "This will get saved in my-subflow-storage."

@flow(result_storage="my-flow-storage")
def my_flow(message):
    print(message)
    my_subflow(message) # results stored in my-subflow-storage
    my_task(message) # results stored in my-task-storage
    my_other_task(message) # results stored in my-flow-storage
    return "This will get saved in my-storage-block."