clearml icon indicating copy to clipboard operation
clearml copied to clipboard

unable to load image when using / in the project name

Open davidenitti opened this issue 3 years ago • 11 comments

when I use the slash / in the project name (to put the project in subprojects e.g. classification/project1) I cannot visualize the images. I realized that the images are save in the directory e.g. classification%2Fproject1, and the url contains the same, but since % is a special character the url should be classification%252Fproject1, that's why it does not work. if there is another way to put the experiments in a subprojects (automatically) and avoid this issue let me know.

davidenitti avatar Feb 18 '22 11:02 davidenitti

Hi @davidenitti ,

I think that we use %2F in the path since that's the quoted representation of /, what you suggest would only work if the path will be unquoted twice...

We'll take a look 🙂

jkhenning avatar Feb 18 '22 16:02 jkhenning

thanks

davidenitti avatar Feb 22 '22 14:02 davidenitti

Hi @davidenitti,

I was not able to reproduce this. I was able to access the image just fine. The link where the image is stored at looks like this for me https://files.clear.ml/bugs%252Freproduce/Image%20reporting...... This is the code I used to try reproduce this:

import numpy as np

from clearml import Task


def report_debug_images(logger, iteration=0):
    m = np.eye(256, 256, dtype=np.float)
    logger.report_image("image/bug", "image float", iteration=iteration, image=m)


def main():
    task = Task.init(project_name="bugs/reproduce", task_name="Image reporting")
    logger = task.get_logger()
    report_debug_images(logger)
    logger.flush()


if __name__ == "__main__":
    main()

Am I missing something?

Thanks!

@eugen-ajechiloae-clearml thanks, I realized now that the problem is only when I save the data offline and then I import them. can you try to use the same code in this example with offline_mode and then import it? thank you very much!

davidenitti avatar Feb 25 '22 10:02 davidenitti

@davidenitti Was able to reproduce it now. Hopefully we will fix this soon :)

@eugen-ajechiloae-clearml thanks, do you know if the bug is client side or server side?

davidenitti avatar Mar 04 '22 10:03 davidenitti

@davidenitti the issue is on client side. We already have a PR for the fix it that awaits review. If you can't wait for a RC, you could solve the problem for your usecase this way:

  1. clone this repo
  2. open clearml/backend_interface/metrics/interface.py in a file editor
  3. add this at the top of the file from ...storage.util import quote_url
  4. call the function you just imported at line 286. so r['url'] = '{}/{}'.format(remote_url, r['key']) becomes r['url'] = quote_url('{}/{}'.format(remote_url, r['key']))
  5. uninstall the clearml version you are using now pip uninstall clearml and install your patched version of clearml: pip install .

ok thanks

davidenitti avatar Mar 10 '22 17:03 davidenitti

@davidenitti After code review, we concluded that you should actually quote that link further down in the code for better results:

    image["source"] = "/".join([remote_url, pre + ".{}".format(task_id), post]):
    if debug_sample not in uploaded_files and debug_sample.is_file():
        uploaded_files.add(debug_sample)
        StorageManager.upload_file(local_file=debug_sample.as_posix(), remote_url=image['source'])
        image["source"] = quote_url(image["source"])   # <------ here

@davidenitti , We have an RC ready for this issue, install it by running pip install clearml==1.3.2rc1 Let us know if this solves the issue

erezalg avatar Mar 24 '22 09:03 erezalg

Hi @davidenitti,

Did you get a chance to test whether this issue is resolved or not?

erezalg avatar May 05 '22 17:05 erezalg

Closing this as it was already released. Please reopen if required.

jkhenning avatar Mar 15 '23 15:03 jkhenning