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

profile bot runs #1066

Open
beckermr opened this issue Jul 17, 2020 · 28 comments
Open

profile bot runs #1066

beckermr opened this issue Jul 17, 2020 · 28 comments

Comments

@beckermr
Copy link
Contributor

We should profile the run of the bot code to see where we are spending most of our time.

@beckermr beckermr added this to the increase bot efficiency milestone Jul 17, 2020
@viniciusdc
Copy link
Contributor

viniciusdc commented Jul 17, 2020

Hi, what bout using cProfile to profile the information of the run and save it somewhere to check it locally with KCacheGrind (or gprof2dot)? This way we can see besides the actual time the current workflow of the calls. It will be also possible to create an interactive visualization at the web services using Django and Chart.js with that information.

@viniciusdc
Copy link
Contributor

OK, besides just to check: when you say the run of the bot code you mean the run function or all the run_bot process? (I should've said it before)

@beckermr
Copy link
Contributor Author

all of the code that makes prs

@viniciusdc
Copy link
Contributor

viniciusdc commented Jul 17, 2020

all of the code that makes prs

I think that is just update_PRs, right ? The others at run and make_graph just load some informations. (We actually have something at the audits, if I remember )

@beckermr
Copy link
Contributor Author

sounds right yes!

@CJ-Wright
Copy link
Member

I think the main thing to profile is all the code in auto_tick.py since this is where the PRs are made (and the migrations are actually performed).

@viniciusdc
Copy link
Contributor

I think the main thing to profile is all the code in auto_tick.py since this is where the PRs are made (and the migrations are actually performed).

Yup, you are alright I thought about that but I was not sure if we would profile the migration too, thanks for the comment.

@CJ-Wright
Copy link
Member

I would profile everything, we need a better view of what is slow so we can fix it.

@viniciusdc
Copy link
Contributor

What do you think ? #1071

@beckermr
Copy link
Contributor Author

i'd be great to see the profile data.

@viniciusdc
Copy link
Contributor

i'd be great to see the profile data.

Inside the client logs ?

@beckermr
Copy link
Contributor Author

the profiler outputs data on what is taking time. i'd be great to have us all look at that data together.

@viniciusdc
Copy link
Contributor

Yup, I agree with you, but I don't get your point, the code is supposed to output the data into a file and them use another tool to see it's information more graphically, but if it's needed to output the data at the terminal window it's also possible. The idea to output the data, was cause this way we can monitor all the function calls and times in a graph, to compare the using memory and other informations

@beckermr
Copy link
Contributor Author

yup. So can you run the profiler on the code and attach the data here?

@viniciusdc
Copy link
Contributor

yup. So can you run the profiler on the code and attach the data here?

it's possible, Matt is conda_build a package ?

@beckermr
Copy link
Contributor Author

yes, you can install it via conda install conda-build

@viniciusdc
Copy link
Contributor

yes, you can install it via conda install conda-build

Oh, thanks I was not sure if conda-build and conda_build were the same

@viniciusdc
Copy link
Contributor

Sorry for the delay, I am having some issues with relative imports. Do you know if this a common mistake I am doing ?

@beckermr
Copy link
Contributor Author

I'd need a code sample. They only work within packages.

@viniciusdc
Copy link
Contributor

An example could be from .xonsh_utils import env or all the relative imports for the auto_tick

@beckermr
Copy link
Contributor Author

hmm that should work as long as you are in a package

@viniciusdc
Copy link
Contributor

viniciusdc commented Jul 21, 2020

hmm that should work as long as you are in a package

Yes,It's been happening a long time, but with minor scripts that I could just one by one remove the inconsistencies but for auto_tick.py there is a lot of subordinate files with relative imports (this is why I started using CI)

@viniciusdc
Copy link
Contributor

With a big help of CJ and Matt, we could finish the tests with the profiler and receive the first outputs 🎉

@viniciusdc
Copy link
Contributor

viniciusdc commented Aug 4, 2020

Now that it's working, we should try to visualize it, I recommend the SnakeViz because of it's browser adaptation. Also, I will try to insert the @profile decorator for further usage.

@beckermr
Copy link
Contributor Author

beckermr commented Aug 4, 2020

Great! Let's chat about the results tomorrow.

@viniciusdc
Copy link
Contributor

I think we can set this done right ?

@beckermr
Copy link
Contributor Author

beckermr commented Aug 4, 2020

Let's wait until we have profiled the PR json steps too.

@viniciusdc
Copy link
Contributor

Let's wait until we have profiled the PR json steps too.

If possible, give a check to #1110

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

No branches or pull requests

3 participants