I am playing with background task and I have noticed a two little problems with the function anvil.server.list_background_tasks()
:
- I was not able to find any documentation, other than this little paragraph
- The
all_environments=True
argument described in that paragraph seems to have no effect. The following code shows a long list when running on its own window, shows nothing when running in the IDE:
@anvil.server.callable
def show_tasks():
n = 0
rows = ['List of tasks:']
for task in anvil.server.list_background_tasks(all_environments=True):
n += 1
rows.append(f'{task.get_task_name()} - {task.get_termination_status() or "running"}')
rows.append(f'Total tasks: {n}')
return '\n'.join(rows)