Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
If I Create A Task Using Task.Create And Then In A Separate Piece Of Code I Want To Report To It (By Using

If I create a task using Task.create and then in a separate piece of code I want to report to it (by using Task.get_task(task_id) ), can I still use the automatical capturing of existing prints, or do I have to explicitely log things using the Logger ? Perhaps the capture_loggin context will help me?

  
  
Posted 2 years ago
Votes Newest

Answers 30


I could have been more inventive as well 😄

  
  
Posted 2 years ago

I can hardcode it into program if you want

  
  
Posted 2 years ago

report_text does not, this is very weird

Okay this seems to be the issue.
Just making sure the Task status is "running" and task.get_logger().report_text("something") does not report a thing ?
Do you see it on your screen?
Can you test without the "Task.debug_simulate_remote_task / init" ?

  
  
Posted 2 years ago

console output:
ClearML results page: 01b77a220869442d80af42efce82c617 some text 2022-03-21 22:47:16,660 - clearml.Task - INFO - Waiting to finish uploads 2022-03-21 22:47:28,217 - clearml.Task - INFO - Finished uploading

  
  
Posted 2 years ago

yes, I am calling Task.init

  
  
Posted 2 years ago

my code snippet
` from clearml import Task
import os

clearml_task_id = os.environ['CLEARML_TASK_ID']
Task.debug_simulate_remote_task(clearml_task_id)
clearml_task = Task.init(auto_connect_arg_parser=False, auto_resource_monitoring=False)
print(clearml_task.id)
clearml_task.logger.report_scalar(series='s', value='123', iteration=2, title='title')
clearml_task.logger.report_text("some text") `

  
  
Posted 2 years ago

yes, I don't know whether you have access to the backend, but just in case my experiment is this one:
ClearML results page: https://app.clear.ml/projects/45557a1ee1464631a9a18b0dcda4f682/experiments/01b77a220869442d80af42efce82c617/output/log

  
  
Posted 2 years ago

I don't know whether you have access to the backend,

Creepy , no I do not 🙂

I can't make anything appear in the console part of the ui

clearml_task.logger.report_text("some text") should work

  
  
Posted 2 years ago

the situation is:
I can report a scalar by calling clearml_task.logger.report_scalar and it becomes immediately visible in the web ui

  
  
Posted 2 years ago

now it stopped working locally as well

At least this is consistent 🙂
How so ? Is the "main" Task still running ?

  
  
Posted 2 years ago

report_scalar works, report_text does not, this is very weird

  
  
Posted 2 years ago

but perhaps it is worth adding to the docs page a hint to avoid using the CLEARML_TASK_ID env variable, perhaps I am not the only one to ever try it

Good idea, any thoughts on where ? I cannot find a trivial place to put these things

  
  
Posted 2 years ago

but seriously, I am very thankful you were willing to spend so much time helping me, I am super impressed by your response time and helpfulness!

  
  
Posted 2 years ago

Just to let you know, it now works (obviously) in the k8s setting as well.

  
  
Posted 2 years ago

maybe not at the top but in the Task.init description

  
  
Posted 2 years ago

LOL, great minds and so on 🙂

  
  
Posted 2 years ago

but perhaps it is worth adding to the docs page a hint to avoid using the CLEARML_TASK_ID env variable, perhaps I am not the only one to ever try it

  
  
Posted 2 years ago

I see the text on my screen

  
  
Posted 2 years ago

YEY 🎉 🎊

  
  
Posted 2 years ago

task status is running in the webui

  
  
Posted 2 years ago

wow

  
  
Posted 2 years ago

I guess we should have obfuscated the name better 😄

  
  
Posted 2 years ago

Thank you! 😊

  
  
Posted 2 years ago

I can't make anything appear in the console part of the ui

  
  
Posted 2 years ago

no, I set the env variable CLEARML_TASK_ID myself

  
  
Posted 2 years ago

no, I set the env variable CLEARML_TASK_ID myself

Do not, this is the issue 🙂
this is used internally and messing up the internal state, basically this is one of the signals for the SDK to know there is an agent taking care of things (for example logging the entire console output)
Use any other variable, for example MY_CLEARML_TASK_ID

  
  
Posted 2 years ago

Wait, how did you end up with
clearml_task_id = os.environ['CLEARML_TASK_ID']printing "01b77a220869442d80af42efce82c617" ?
This means you are running by an agent?!

  
  
Posted 2 years ago

now it stopped working locally as well

  
  
Posted 2 years ago

So it is the automagic that is not working.
Can you print the following before calling Both Task.debug_simulate_remote_task and Task.init , Notice you have to call Task.init
print(os.environ)

  
  
Posted 2 years ago
655 Views
30 Answers
2 years ago
one year ago
Tags