https://prefect.io logo
Title
a

Adam Brusselback

09/02/2022, 2:50 PM
Hey all, I am just trying to run a flow from the UI that works just fine when kicked off from python... I am just using the "Get Github Stars" flow/task from the docs, and wanted to pass in params from the UI. It is not going as expected. When I am trying to pass them in from the UI, I get each character passed to the task instead of each individual string in the parameters. See screenshots in thread. Is this just a formatting issue with the parameters?
1
flow code for reference:
import httpx
from prefect import flow, task


@task(retries=3)
def get_stars(repo):
    url = f"<https://api.github.com/repos/{repo}>"
    count = httpx.get(url).json()["stargazers_count"]
    print(f"{repo} has {count} stars!")


@flow()
def github_stars(repos):
    for repo in repos:
        get_stars.submit(repo)


# call the flow!
if __name__ == "__main__":
    github_stars(["PrefectHQ/Prefect", "PrefectHQ/prefect-aws", "PrefectHQ/prefect-dbt"])
j

Jenny

09/02/2022, 7:31 PM
Hi @Adam Brusselback - can you try adding a type to your parameter so the UI knows what type you are trying to enter? I find the list here at pydantic useful: https://pydantic-docs.helpmanual.io/usage/types/
a

Adam Brusselback

09/02/2022, 8:08 PM
I did try that, no dice on getting it working though.
import httpx
from prefect import flow, task


@task(retries=3)
def get_stars(repo: str):
    url = f"<https://api.github.com/repos/{repo}>"
    count = httpx.get(url).json()["stargazers_count"]
    print(f"{repo} has {count} stars!")


@flow()
def github_stars(repos: list):
    for repo in repos:
        get_stars.submit(repo)


# call the flow!
if __name__ == "__main__":
    github_stars(["PrefectHQ/Prefect", "PrefectHQ/prefect-aws", "PrefectHQ/prefect-dbt"])
j

Jeff Hale

09/02/2022, 8:11 PM
Looks like it’s a 🐛. There’s an open issue on the topic that you can track here. Please add a comment if it’s an important use case for you.
a

Adam Brusselback

09/02/2022, 8:59 PM
It's somewhat important, was planning on having somewhat rich parameter lists built out for my tasks, and the ability to pass in lists of values is one of the requirements
j

Jenny

09/02/2022, 9:03 PM
Thanks @Adam Brusselback - apologies that I didn't recognize the bug. The team are actively working on this one!
👍 1