f

    Francois van Heerden

    7 months ago
    Is it possible to include a link to a pdf produced as output from a run using the
    Artifacts
    api? I’m currently using the server backed and a local agent.
    Kevin Kho

    Kevin Kho

    7 months ago
    Hi @Francois van Heerden, did you run into an issue when trying? There is a
    create_link_artifact
    f

    Francois van Heerden

    7 months ago
    Yes, sorry dit try (the very naive)
    create_link_artifact("file:///<full_path>")
    but this created a link with
    localhost:8080/default/flow-run
    prepended on the host machine and
    <host_ip>:8080/flow_run
    on a remote machine, casing a 404 error when accessing the link.
    Kevin Kho

    Kevin Kho

    7 months ago
    Could you show me the code that you tried?
    f

    Francois van Heerden

    7 months ago
    @task(name='Link Document')
    def link_document(path):
    
        # create_link_artifact('file:///{}'.format(path.replace('\\', '/')))
    
        create_markdown_artifact("Report available at [link](\"file:///{}\").".format(path))
    These are the two methods I tried. The
    create_markdown_artifact
    creates an empty link, while the
    create_link_artifact
    produces the link with server path prepended as described above.
    Kevin Kho

    Kevin Kho

    7 months ago
    Ahh ok I see what you mean but I’m not sure. What you want the link to be? Cuz I don’t think you’ll be able to access the link like that from a remote machine?
    f

    Francois van Heerden

    7 months ago
    Ideally an embedded pdf with a download option, in html:
    <object data="{}" type="application/pdf" width="700px" height="700px">
        <embed src="{}">
            <p>This browser does not support PDFs. Please download the PDF to view it: <a href="{}">Download PDF</a>.</p>
        </embed>
    </object>
    But I understand that this might be a challenge, as the server is running in a Docker container with no access to the file system.
    Kevin Kho

    Kevin Kho

    7 months ago
    I personally don’t know how to shape this link to download from remote. I think this all becomes easier if you maybe use something like S3 to host it?
    f

    Francois van Heerden

    7 months ago
    Yes, this is more or less how I currently handle it (use local hosting instead of S3). Was hoping to avoid the additional copying around, as in many instances the pdf will be overwritten many times. Thanks for the help!