You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build a launch configuration that will,
submit a python script to be ran on a server farm,
wait for an indication that the script has started a debugpy server, and is listening for connections,
ascertain the machine that is now listening for a debug client connection, and
proceed to connect the debugger client to the remote server.
I have coded this solution as follows:
launch.json runs a preLaunchTask called launchTest, that uses a shell script to,
submit the job to run on the farm.
waits for a file to exist that contains what machine the job is running on, and also indicates the debug server is now listening.
launch.json also defines the host to connect to as ${input:debugpyLauncHost}
input:debugpyLauncHost uses extension.commandvariable.file.content to get the value from the file.
It appears that the launch configuration evaluates the value of ${input:debugpyLauncHost}, before running the preLaunchTask. Because, while launchTest starts the server and the file is created with the machine name, ${input:debugpyLauncHost} returns nothing, and the host connection fails.
I experimented with added delays after the file exists, but regardless of the length it doesn't matter. If on the other hand, I pre-populate the file before running the launch configuration ( and forcing the job to run on that specific machine ), ${input:debugpyLauncHost} successfully returns the machine name from the file and the client connects to the server.
You can define a key binding that will run the preLaunchTask and then launch a named launch config.
VSC has the command runCommands but it does not wait till the task is finished and you can't add a delay between commands. The extension multi-command is an alternative with delay option.
I have chosen to define shift+F5 to start this sequence:
I'm trying to build a launch configuration that will,
I have coded this solution as follows:
launch.json
runs apreLaunchTask
calledlaunchTest
, that uses a shell script to,launch.json
also defines the host to connect to as${input:debugpyLauncHost}
input:debugpyLauncHost
usesextension.commandvariable.file.content
to get the value from the file.It appears that the launch configuration evaluates the value of
${input:debugpyLauncHost}
, before running thepreLaunchTask
. Because, whilelaunchTest
starts the server and the file is created with the machine name,${input:debugpyLauncHost}
returns nothing, and the host connection fails.I experimented with added delays after the file exists, but regardless of the length it doesn't matter. If on the other hand, I pre-populate the file before running the launch configuration ( and forcing the job to run on that specific machine ),
${input:debugpyLauncHost}
successfully returns the machine name from the file and the client connects to the server.launch.json
tasks.json
The details of
launch_test.sh
aren't important, but it's working as expected.Is there another way to leverage this extension to accomplish my goal?
The text was updated successfully, but these errors were encountered: