Skip to content

Assignable task names for logging purposes #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m-fila opened this issue Jul 10, 2024 · 2 comments · Fixed by #560
Closed

Assignable task names for logging purposes #545

m-fila opened this issue Jul 10, 2024 · 2 comments · Fixed by #560

Comments

@m-fila
Copy link
Contributor

m-fila commented Jul 10, 2024

Currently the names of tasks are inferred from the names of scheduled functions or callables through reflexion. In the code I'm experimenting with most of the tasks are closures or some mockups, so they either end up with with names like #242 or they all have the same name.
I think that for visualization and debugging it would be very useful to be able to assign programmatically a human readable name

I'd appreciate if something like this was possible:

a = Dagger.@spawn name="taskA" mockup_job(x,y,z)
b = Dagger.@spawn name="taskB" mockup_job(u,v,w)
c = Dagger.@spawn name="taskC" mockup_job(a,b)

so in the logs and visualization the taks could appear as taskA, taskB, taskC instead of mockup_job, mockup_job, mockup_job

@jpsamaroo
Copy link
Member

There is already a bit of logic that does this for data (not yet for tasks), in the form of Dagger.logs_annotate!(data, name), which is used by the :graphviz renderer to give names to data nodes in the generated GraphViz graph. I'd be open to adding support for this syntax to @spawn - this logic could be added after

return DTask(uid, future, finalizer_ref)
(just before the DTask is returned) probably. We'd want to probably add a separate logs_annotate! method for DTask so that it can also write t.uid into the logs as the key (maybe we can put it under a :task_annotation category).

We'll potentially also want another log event to be generated around

that maps from the DTask uid to the Thunk tid, so that renderers can then use that to do the lookup from uid -> tid when filling out task names (as those two IDs are currently different per task). This event can eventually be removed once we unify uids and tids, which I have a local branch for doing.

@jpsamaroo
Copy link
Member

I'm going to self-assign this, since I had to build out most of this infrastructure for another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants