I am trying to add support for debuggers for actionloop based languages, for 
example go or python.

I looked to the wskdebug but I am not sure how to make it work with actionloop. 
My goal is to have it working the Standalone Openwhisk only, using VSCode to 
control the debugger.
So I am following this approach. 

Generally, debuggers work starting execution with some special parameters to 
have the debugger listening in some port.
So the idea is to add an annotation like "-a debugPort 8888"
You would create an action with "wsk action create hello hello.go -a debugPort 
8888"

The effect of the annotation would be to launch a runtime with the additional 
parameter   "-p 8888:8888" on the docker command line, and an  
additional_OW_DEBUG_PORT=8888 enviroment variable.

I will then modify each actionloop runtime to execute code under a debugger 
listening in the given port  when they see the _OW_DEBUG_PORT environment 
variable set. This should happen at init time. It is similar to the _OW_APIHOST 
environment variable we already have.

Now we have an action listening for a debugger. To connect with VSCode (or 
other debuggers) we need now to generate a configuration. The idea is to modify 
the action loop proxy to handle specially any request with the "debugWith" 
parameter, that will be served directly by the proxy to gather informations 
about the execution environment. 

So to generate the configuration you would use:

"wsk action invoke hello -p debugWith vscode -r >launcher.json"

the result will be the launcher configuration for VSCode, with all the 
parameters like the IP, required to connect to the action with the debugger.

So you can now start the debugger, put breakpoints, invoke the action and trace 
it in the debugger.

To implement this plan I need to change the docker factory to handle the 
annotation. Also I have a doubt that, after you got the debugger configuration, 
the system will NOT fork another action. I guess that under the Standalone 
Docker the LeanBalancer does not fork more actions, am I right?

How does this plan sound? Approved?




 




-- 
  Michele Sciabarra
  [email protected]

Reply via email to