Hey, it is my first time using Prefect and I am ru...
# ask-community
g
Hey, it is my first time using Prefect and I am running into an issue with the UI not showing jobs I run locally. Is there something I am doing wrong from the quickstart? I run to start the server
Copy code
prefect server start
I export the API URL ( I am on osx )
Copy code
export PREFECT_API_URL="<http://localhost:4200/api>"
This is the code I run locally
Copy code
import httpx   # an HTTP client library and dependency of Prefect
from prefect import flow, task

@task(retries=2)
def get_repo_info(repo_owner: str, repo_name: str):
    """Get info about a repo - will retry twice after failing"""
    url = f"<https://api.github.com/repos/{repo_owner}/{repo_name}>"
    api_response = httpx.get(url)
    api_response.raise_for_status()
    repo_info = api_response.json()
    return repo_info

@task
def get_contributors(repo_info: dict):
    """Get contributors for a repo"""
    contributors_url = repo_info["contributors_url"]
    response = httpx.get(contributors_url)
    response.raise_for_status()
    contributors = response.json()
    return contributors

@flow(log_prints=True)
def log_repo_info(repo_owner: str = "PrefectHQ", repo_name: str = "prefect"):
    """
    Given a GitHub repository, logs the number of stargazers
    and contributors for that repo.
    """
    repo_info = get_repo_info(repo_owner, repo_name)
    print(f"Stars 🌠 : {repo_info['stargazers_count']}")

    contributors = get_contributors(repo_info)
    print(f"Number of contributors 👷: {len(contributors)}")

if __name__ == "__main__":
    log_repo_info()
This is what I get in the logs
Copy code
18:39:02.707 | INFO    | prefect.engine - Created flow run 'smoky-perch' for flow 'log-repo-info'
18:39:02.708 | INFO    | prefect.engine - View at <http://localhost:4200/runs/flow-run/d63d462d-e83d-409c-aa7d-bc03193150fe>
18:39:03.051 | INFO    | Task run 'get_repo_info-168' - Finished in state Completed()
18:39:03.058 | INFO    | Flow run 'smoky-perch' - Stars 🌠 : 16204
18:39:03.412 | INFO    | Task run 'get_contributors-b97' - Finished in state Completed()
18:39:03.414 | INFO    | Flow run 'smoky-perch' - Number of contributors 👷: 30
18:39:03.448 | INFO    | Flow run 'smoky-perch' - Finished in state Completed()
This is what I get at the URL :
Copy code
<http://localhost:4200/runs/flow-run/d63d462d-e83d-409c-aa7d-bc03193150fe>
a
@Gunnar Hi Gunnar! I had a similar issue and it turned out to be something related to sqlite3 I just didnt have it installed, although this was a linux installation Im not sure about OSX. Cheers!
👍 1
🚀 1
gratitude thank you 1
g
What did you end up doing to sqlite3 to make it work?
sweet, just figured it out. my sqllite3 was corrupted
wizard2 1
a
Nothing, I just installed it
sudo apt install sqlite3
Awesome!