yuvipanda / hubtraf

Traffic simulator for JupyterHub
BSD 3-Clause "New" or "Revised" License
40 stars 24 forks source link

Executing whole jupyter notebooks #4

Closed 1kastner closed 4 years ago

1kastner commented 6 years ago

I had a closer look at user.py and I was able to use it for some scripting. Thanks for preparing this piece of software in a way that it can be used like a library! For testing different scenarios I used a similar style to __main__.py only that I wrote the scenarios directly in python and not through the shell with arguments. If it is of help, I could add my approach to this repository, but it might be a bit out of the intended focus of the project.

For improving the kind of load tests I want to do I thought about executing whole notebooks. That way I could test not only single commands to check whether the notebook is running, but even whether a bunch of users is capable of reading large files from the disk at the same time (sorry hardware guys) or calculating some machine learning results in parallel. I could send it code line by code line, but sending a whole notebook would be much fancier. Would that be possible and in the scope of this project?

1kastner commented 6 years ago

Some research task here: I could not find a specified protocol but of course it is part of the jupyter notebook code, cf:

That means executing a notebook equals to open the ipynb file, parsing the json and sending each command separately to the same kernel.

1kastner commented 4 years ago

My solution now is to convert a Jupyter Notebook into a Python file using nbconver. In the second step I read in the whole pytohn script and execute it by using "assert_code_output" in the user file.