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
Hi, Similar To Task.Set_Offline(True), Is There A Way To Simulate An Execution In An Agent? (For Testing Purposes)

Hi, similar to Task.set_offline(True), is there a way to simulate an execution in an agent? (for testing purposes)

  
  
Posted one year ago
Votes Newest

Answers 27


I want in my CI tests to reproduce a run in an agent

you mean to run it on the CI machine ?

because the env changes and some things break in agents and not locally

That should not happen, no? Maybe there is a bug that needs fixing on clearml-agent ?

  
  
Posted one year ago

I want in my CI tests to reproduce a run in an agent because the env changes and some things break in agents and not locally

  
  
Posted one year ago

JitteryCoyote63 of course there is 🙂
Task.debug_simulate_remote_task(task_id="<task_id_here>")

  
  
Posted one year ago

Ho wow! is it possible to not specify a remote task? (If i am working with Task.set_offline(True))

  
  
Posted one year ago

JitteryCoyote63 if this is simulating an agent, the assumption is that the Task was already created, hence the task ID.

If i am working with Task.set_offline(True)

How would the two combine ? I mean off-line is be definition not executed by an agent, what am I missing ?

  
  
Posted one year ago

you mean to run it on the CI machine ?

yes

That should not happen, no? Maybe there is a bug that needs fixing on clearml-agent ?

It just to test that the logic being executed in if not Task.running_locally() is correct

  
  
Posted one year ago

Since I'm assuming there is no actual task to run, and you do not need to setup the environment (is that correct?)
you can do:
$ CLEARML_OFFLINE_MODE=1 python3 my_main.pywdyt?

  
  
Posted one year ago

ClearML maintains a github action that sets up a dummy clearml-server,

You have one, it's the http://app.clear.ml (not a dummy one, but for this purpose it will work)
thoughts ?

  
  
Posted one year ago

It's the same but done from outside, you want the same and "offline" as well right?

  
  
Posted one year ago

is it different from Task.set_offline(True)?

  
  
Posted one year ago

Actually I think I am approaching the problem from the wrong angle

  
  
Posted one year ago

In my github action, I should just have a dummy clearml server and run the task there, connecting to this dummy clearml server

  
  
Posted one year ago

so that any error that could arise from communication with the server could be tested

  
  
Posted one year ago

even if I move the Github workers internally where they could have access to the prod server, I am not sure I would like that, because it would pile up test data in the prod server that is not necessary

  
  
Posted one year ago

Because it lives behind a VPN and github workers don’t have access to it

  
  
Posted one year ago

oh, if this is the case, why not use the "main" server?

  
  
Posted one year ago

Because it lives behind a VPN and github workers don’t have access to it

makes sense
If this is the case, I have to admit that combining offline-mode and remote execution makes sense, no?

  
  
Posted one year ago

yes exactly

  
  
Posted one year ago

I’d like to move to a setup where I don’t need these tricks

  
  
Posted one year ago

So there is a hack for it:
CLEARML_OFFLINE_MODE=1 python3 my_main.pyWhich is the same as calling Task.set_offline
Then inside the code After the Task.init call:
` task = Task.init(...)

not sure what the if here is?!

Task.debug_simulate_remote_task(task_id="offline-1") `This will make things act as if this is running remotely , i.e. your logic Task.running_remotely() will be called.
Do notice that in remote mode, all the arguments / data is read from the clearml-server into the code, and since this is an offline mode, I'm not sure what you'll be getting. (it seems to be workign as expected, i.e. you get what you started with, but I would make sure again)
Make sense ?

  
  
Posted one year ago

and just run the same code I run production

  
  
Posted one year ago

That said , if you could open a github issue and explain the idea behind it, I think a lot of people will be happy to have such process , i.e. CI process verifying code. And I think we should have a "CI" flag doing exactly what we have in the "hack" wdyt?

  
  
Posted one year ago

It does, tested 🙂 but you should as well

  
  
Posted one year ago

wow if this works that’s amazing

  
  
Posted one year ago

Let me check something

  
  
Posted one year ago

I think the best case scenario would be that ClearML maintains a github action that sets up a dummy clearml-server, so that anyone can use it as a basis to run their tests, so that they just have to change to URL of the server to the local one executed in the github action and they can test seamlessly all their code, wdyt?

  
  
Posted one year ago

mmmh good point actually, I didn’t think about it

  
  
Posted one year ago
567 Views
27 Answers
one year ago
one year ago
Tags