-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Print an execution summary at end of task runs #1091
Conversation
lines.append(row) | ||
break | ||
if len(tasks[0].get_params()) == 1: | ||
row += "- " + str(len(tasks)) + " " + str(task_family) + "(" + tasks[0].get_params()[0][0] + "=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use formatting strings here
if task.task_family in group_tasks[status]: | ||
group_tasks[status][task.task_family].append(task) | ||
else: | ||
group_tasks[status][task.task_family] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can do group_tasks[status][task.task_family].setdefault([]).append(task)
I think
63f94d7
to
2d23a77
Compare
|
||
def requires(self): | ||
yield MyExternal() | ||
for i in range(1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason. I think I added it by mistake. I'll remove it.
This looks like a great addition to Luigi! Hope you're not dissuaded by all the comments – every code base has its conventions, and I generally think these reviews are a great way to learn from everyone's best practices |
@erikbern What's your opinion on printing out which the external workers were if there were any and which tasks they ran? Because I have that in the code now but I don't know if it's informative or just in the way. |
Can you provide some sample output of what that looks like? |
===== Luigi Execution Summary ===== Scheduled 57 tasks of which:
The other workers were: Did not run any tasks ===== Luigi Execution Summary ===== This is how it looks if it prints out only how many tasks each worker ran and that is how we currently have it. @erikbern |
===== Luigi Execution Summary ===== Scheduled 57 tasks of which:
The other workers were: Did not run any tasks ===== Luigi Execution Summary ===== This is how it would look like if we also printed out which tasks it ran. @erikbern |
641a9f0
to
793bee3
Compare
|
||
|
||
def _get_statuses(): | ||
statuses = ["already_done", "completed", "failed", "still_pending", "still_pending_ext", "run_by_other_worker", "upstream_failure", "upstream_missing_dependency", "upstream_run_by_other_worker", "unknown_reason"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statuses are repeated in other parts of the code (_partition_tasks). Should only be hardcoded in one place. Using a class would have been a whole lot easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also maybe this should just be a list of reasons and comments that are being looped over
Cool. I'll iterate on making this code a bit cleaner then. |
46d2fde
to
cd10837
Compare
return set_tasks | ||
|
||
|
||
def _dfs(set_tasks, current_task, visited): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to name this not an acronym.
See docs in luigi/execution_summary.py for example of output. This squashed commit is joint work between Nicole and Arash. Signed-off-by: Arash Rouhani <arash@spotify.com>
cd10837
to
ef76e7c
Compare
Overall this code could be improved and become more readable. It could use some more comments and operate more with classes instead of dicts and sets. I will let it pass because this is @nicolehedblom's first contribution. Considering that I think she did great! I have reached out to her separately with some tips and tricks. Considering that, LGTM. |
Well, the code is not using all the nice OOP-practices. But I think it makes it easier in some sense that it's only using primitive types. Thanks for review! :) |
Print an execution summary at end of task runs
Yes this is a great addition and there's some various things that could be cleaned up but overall it doesn't matter as much since this is a separate module with a very small interface and this thing clearly has pretty high utility. Looking forward to some more subsequent PR's! |
Yea :) |
See docs in luigi/execution_summary.py for example of output.