Hi TeenyFly97 ,
With task.close()
the task will do a full shutdown process. This includes repo detection, logs, metrics and artifacts flush, and more. The task will not be the running task anymore and you can start a new task.
With task.mark_stopped()
, the task logs will be flushed and the task will mark itself as stopped
, but will not perform the full shutdown process, so the current_task
will still be this task.
For example:
` from trains import Task
task = Task.init(project_name="example", task_name="task closed")
print(task.current_task().id) # will print first task id
task.close()
print(type(task.current_task())) # will print <class 'NoneType'>
task = Task.init(project_name="example", task_name="Second task")
print(task.current_task().id) # will print second task id This code will create two different tasks, and
print(type(task.current_task())) line will print
NoneType ` .
` from trains import Task
task = Task.init(project_name="example", task_name="task marked stopped")
print(task.current_task().id) # will print first task id
task.mark_stopped()
print(type(task.current_task())) # will print <class 'trains.task.Task'>
task = Task.init(project_name="example", task_name="Second task") # will raise trains UsageError exception This code will create only one task, and the
print(type(task.current_task())) line will print the task object, but in the second
Task.init` call, we will get an exception.