Hello Everyone, I am really sorry I am asking thi...
# ask-community
s
Hello Everyone, I am really sorry I am asking this question in the wrong channel. I am trying to set up Prefect and using Bitbucket as storage.
Copy code
STORAGE = Bitbucket(
        project="PrefectDemoECS",                            # name of project
        repo="prefect",                          # name of repo in project
        path="demo.py",                      # location of flow file in repo
        workspace="sandipviradiya",	
        cloud_username_secret="bb_username",
        cloud_app_password_secret="bb_app_password"
    )
It is showing me the 404 error as the given image. I checked the code https://github.com/PrefectHQ/prefect/blob/a2025983352d7e152da88358c3e578f3ce73778a/src/prefect/storage/bitbucket.py#L29 and it seems it is not selecting the Bitbucket cloud function and trying the Bitbucket server fetch only. Any guidance will be really helpful.
k
Hey @Sandip Viradiya, are
cloud_username_secret
and
cloud_app_passwork_secret
the names of Prefect Secrets stored in the Cloud? Or are you passing the value as a string directly?
s
@Kevin Kho Thank you for the response and apologies for the delayed response, I think it is the time difference. I am in Sydney, Australia. Yeah,
cloud_username_secret
 and 
cloud_app_passwork_secret
 are cloud secrets. We just need to pass the name of the secrets as per the documentation. The main part is, it is not going in cloud code it self it seems. I dig into the Prefect code and if we have passed
workspace
it should go to cloud code instead of the server code to fetch the Bitbucket flow. You can refer the image attached. It is not getting the Bitbucket path right. If you see the Bitbucket URL, it is the server code it is trying to fetch. If it goes in Cloud code it should show workspace name where it is trying to fetch the Bitbucket flow from (as per the Prefect code https://github.com/PrefectHQ/prefect/blob/a2025983352d7e152da88358c3e578f3ce73778a/src/prefect/storage/bitbucket.py#L29 ). Thanks
k
I see what you are saying. What version are you on? Cloud support was added in 0.14.16
s
Wooo.. That could be an issue. I am using prefecthq/prefect:0.14.0
Why I did not thought of that. Let me try once. 🤞
It is working now. Thanks for the help @Kevin Kho
👍 1
k
Glad you got it working!
s
Hey @Kevin Kho Sorry for disturbing you again. I am trying to save the result on S3 bucket but it is not working. Below is the code I used for your reference. Secrets are stored on Prefect and it is working for the cluster I am using.
Copy code
target="hardcore.bytes"
RESULT = S3Result(
            bucket='prefect-cache',
            location=target,
            boto3_kwargs=dict(
                aws_access_key_id=Secret("aws_access_key_id").get(),
                aws_secret_access_key=Secret("aws_secret_access_key").get(),
                #endpoint_url=os.getenv("AWS_S3_ENDPOINT"),
            )
    )

@task
def hi():
    logger = prefect.context.get('logger')
    <http://logger.info|logger.info>("Hello S3Result !")


with Flow("prefect-dask-bb-result", storage=STORAGE, run_config=RUN_CONFIG, executor=EXECUTOR, result=RESULT) as flow:
    hi()
The strange part is, I can not see anything in the task log. It shows everything from Task submitted to Bitbucket code fetch to Success. As per the code of S3Result, https://github.com/PrefectHQ/prefect/blob/a2025983352d7e152da88358c3e578f3ce73778a/src/prefect/engine/results/s3_result.py it should show me the file upload in the log. That means it is not trying to save the result on S3Result. Am I missing something? Thanks in advance. 🍻
k
Hey, can you try returning an explicit value in the
hi
task? What happens if you
return 1
The setup looks right btw from what I can tell