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
Hello There, I Would Like To Do Run Cleanup Code In Case The User Aborts One Task From The Dashboard (The Agent Is Not Using The Task In Docker). What Signal Should I Listen For In The Task?

Hello there,
I would like to do run cleanup code in case the user aborts one task from the dashboard (the agent is not using the task in docker). What signal should I listen for in the task?

  
  
Posted 4 years ago
Votes Newest

Answers 18


Well, how would you imagine it running? Did you intend for it to run as part of the executed task itself?

  
  
Posted 4 years ago

Ok, but that means this cleanup code should live somewhere else than inside the task itself right? Otherwise it won't be executed since the task will be killed

  
  
Posted 4 years ago

Hi JitteryCoyote63 ,
Will this task be executed in development mode (i.e. locally) or using Trains Agent?

  
  
Posted 4 years ago

I mean kill a detached subprocess on the machine executing the agent

Oh, I see. Now I understand why you want it on the same remote machine...

  
  
Posted 4 years ago

The clean up service is awesome, but it would require to have another agent running in services mode in the same machine, which I would rather avoid

  
  
Posted 4 years ago

That's the purpose of the Trains Agent Services mode - in a nutshell, you run an agent who's purpose if to run cpu-only maintenance tasks that take care of things like cleanup

  
  
Posted 4 years ago

The task requires this service, so the task starts it on the machine - Then I want to make sure the service is closed by the task upon completion/failure/abortion

  
  
Posted 4 years ago

In that case, you can monitor the Task's status_reason field which should contain "task was stopped by tasks.stop"

  
  
Posted 4 years ago

mmh it looks like what I was looking for, I will give it a try 🙂

  
  
Posted 4 years ago

yes, exactly 🙂

  
  
Posted 4 years ago

Also maybe we are not on the same page - by clean up, I mean kill a detached subprocess on the machine executing the agent

  
  
Posted 4 years ago

I am looking for a way to gracefully stop the task (clean up artifacts, shutdown backend service) on the agent

  
  
Posted 4 years ago

Can you make do with atexit.register ?

  
  
Posted 4 years ago

using Trains Agent 🙂

  
  
Posted 4 years ago

The Trains Agent that is actually running your experiment already detects the user abort selected in the UI and stops executing. The Cleanup Server picks up on that and can clean up whatever you desire (i.e. by adapting the cleanup service code)

  
  
Posted 4 years ago

Just to make sure we're on the same page, the cleanup code won't actually listen for a signal, but will sample the tasks periodically and look for the above-mentioned status reason in tasks whose status field is stopped (when getting tasks from the server in the cleanup code, you can't query on the status_reason field, but you can query on the status field)

  
  
Posted 4 years ago
980 Views
18 Answers
4 years ago
one year ago
Tags