jupyter / kernel_gateway_demos

Demos associated with the kernel gateway incubator project
BSD 3-Clause "New" or "Revised" License
152 stars 76 forks source link

Add parameters to client.py and client.js #37

Open dockter-84 opened 8 years ago

dockter-84 commented 8 years ago

Because there's a "hardcoded" relationship between input parameter, kernel name, and source code file, we are not able to run the python, scala, and R demos on kernels with different kernel names.

https://github.com/jupyter/kernel_gateway_demos/blob/b7fd80bda9e9b99f0c450c72ea5dc5aff55bd989/node_client_example/src/client.js#L15

Can you add parameters like --kernel-name <kernel_name> and --source <filename> to the client.py and client.js demonstration programs? These parameters would supersede the values in the dictionary within the code.

That way we could run:

node client.js --kernel-name new-scala-version  --source example.scala
dockter-84 commented 8 years ago

As a work-around, I'm doing this after cloning the repository:

sed -i.$(date +'%s') \
  -e s/"kernelName: 'python'"/"kernelName: 'python2-spark20'"/g \
  -e s/"kernelName: 'scala'"/"kernelName: 'scala-spark20'"/g \
  -e s/"kernelName: 'ir'"/"kernelName: 'r-spark20'"/g \
  ~/kernel_gateway_demos/node_client_example/src/client.js
parente commented 7 years ago

@dockter-84 I'm happy to take a PR here that extends the demo scripts with the kernel-name and source parameters.

/cc @DTAIEB