Skip to content
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

Add REST endpoint to get DOT graph of a job #242

Merged
merged 25 commits into from
Sep 27, 2022

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Sep 18, 2022

Which issue does this PR close?

N/A

Rationale for this change

This is essential to comprehending how Ballista is executing a query.

test

What changes are included in this PR?

New endpoint: http://localhost:50050/api/job/<job-id>/dot

Are there any user-facing changes?

@andygrove andygrove changed the title Add REST endpoint to get dot graph of a job WIP: Add REST endpoint to get dot graph of a job Sep 18, 2022
Copy link
Contributor

@avantgardnerio avantgardnerio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! What generates the png?

@andygrove
Copy link
Member Author

Very nice! What generates the png?

http://localhost:50050/jobs/<job-id>/dot serves up the raw dot file. I am converting to png locally. I would like the Web UI to just render this though.

@avantgardnerio
Copy link
Contributor

Very nice! What generates the png?

http://localhost:50050/jobs/<job-id>/dot serves up the raw dot file. I am converting to png locally. I would like the Web UI to just render this though.

I didn't think this was possible, but it looks like someone has transpiled graphviz to wasm so it runs in the browser now https://github.com/magjac/d3-graphviz.

@yahoNanJing
Copy link
Contributor

very nice graph

@andygrove
Copy link
Member Author

@yahoNanJing @thinkharderdev @avantgardnerio This is now ready for review. I will follow up with smaller PRs to improve formatting and add metrics.

@andygrove andygrove changed the title WIP: Add REST endpoint to get dot graph of a job Add REST endpoint to get DOT graph of a job Sep 24, 2022
@andygrove andygrove marked this pull request as ready for review September 24, 2022 18:19
Ok(state)
}

fn write_plan_recursive(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use/move something similar to DataFusion (minus the stage part, currently).

@yahoNanJing
Copy link
Contributor

LGTM

// truncate after translation because we know we only have ASCII chars at this point
// so the slice is safe (not splitting unicode character bytes)
if let Some(limit) = max_len {
if sanitized.len() > limit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use String::truncate?

sanitize(str, Some(100))
}

/// Make strings dot-friendly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK labels can be quoted like this

"Thïs įs a 🦄 and a \" quote"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So surround by quotes and escape quote character is all that's needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try this, and it failed, but maybe I made a mistake ... I will try again in the next PR

Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments but looks great 😃

@andygrove
Copy link
Member Author

Thanks for the review @Dandandan and @yahoNanJing

@andygrove andygrove merged commit 56f952f into apache:master Sep 27, 2022
@andygrove andygrove deleted the generate-dot branch September 27, 2022 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants