The remote batch ssh is not compatible with Windows-based servers. A work in progress solution is on a separate development branch "windows_remote_ssh". There are a number of issues:
The command to cd and unzip and run the model are not formatted correctly. Linux uses the ';' char to separate commands, and windows uses either the '&' or '&&' command. The double ampersand is a conditional command separator that will only execute the second commands if the previous is successful. This has been corrected in the repo.
The command to check if the java task is running on the remote server is different in Windows. This has been corrected in the repo. However, the current code only checks if java.exe is running on the server. This is brittle since other unrelated java processes could be running. The Windows command can also return the process ID which should be used instead.
Running background jobs in Windows is not natively supported like the nohup process in linux. It's possible to use the Windows powershell Start-Process to start a background process, however it will terminate when the ssh session disconnects. This is a fundamental limitation of Windows - processes that are started in a login session will terminate when a user disconnects. Furthermore, using powershell assumes that the remote user has elevated privileges on the host, which may be unreasonable, so the powershell approach may not be the best option. Starting a model remotely via ssh does work, it's just that we cannot disconnect the session. The current Repast RemoteSession workflow starts a background process of the model, disconnects the session, and then regularly polls the host to see if the model is finished. If we want this to work on a Windows server, the ssh session that starts the model will need to remain connected until the model completes. This raises a few questions:
Why is the remote ssh session disconnected in the first place instead of just waiting for the model to complete? Is there a timeout issue?
Can we start the remote session in a separate java thread and let it stay connected, and then use the main thread to start the model completion polling ?
The remote batch ssh is not compatible with Windows-based servers. A work in progress solution is on a separate development branch "windows_remote_ssh". There are a number of issues:
The command to cd and unzip and run the model are not formatted correctly. Linux uses the ';' char to separate commands, and windows uses either the '&' or '&&' command. The double ampersand is a conditional command separator that will only execute the second commands if the previous is successful. This has been corrected in the repo.
The command to check if the java task is running on the remote server is different in Windows. This has been corrected in the repo. However, the current code only checks if java.exe is running on the server. This is brittle since other unrelated java processes could be running. The Windows command can also return the process ID which should be used instead.
Running background jobs in Windows is not natively supported like the nohup process in linux. It's possible to use the Windows powershell Start-Process to start a background process, however it will terminate when the ssh session disconnects. This is a fundamental limitation of Windows - processes that are started in a login session will terminate when a user disconnects. Furthermore, using powershell assumes that the remote user has elevated privileges on the host, which may be unreasonable, so the powershell approach may not be the best option. Starting a model remotely via ssh does work, it's just that we cannot disconnect the session. The current Repast RemoteSession workflow starts a background process of the model, disconnects the session, and then regularly polls the host to see if the model is finished. If we want this to work on a Windows server, the ssh session that starts the model will need to remain connected until the model completes. This raises a few questions:
Why is the remote ssh session disconnected in the first place instead of just waiting for the model to complete? Is there a timeout issue?
Can we start the remote session in a separate java thread and let it stay connected, and then use the main thread to start the model completion polling ?