DEPONS Forums
Running DEPONS on remote server - Printable Version

+- DEPONS Forums (https://depons.eu/forums)
+-- Forum: Technical issues (https://depons.eu/forums/forum-1.html)
+--- Forum: Issues with installation (https://depons.eu/forums/forum-2.html)
+--- Thread: Running DEPONS on remote server (/thread-2.html)



Running DEPONS on remote server - ida_carlen - 13-11-2020

Hi! My computer is old and slow so I need to run DEPONS on a remote server. How can I run the workload on a headless Linux server remotely?

Ida


RE: Running DEPONS on remote server - jonasa - 16-11-2020

Hi Ida,

The model can be executed on remote hosts as part of a batch run. This requires that you have set up SSH key-based authentication with the private key on your computer and the public key correctly configured on the remote server. Assuming this is in place, the instructions below describe how to run the model on the remote server.

From the main window, click on the little yellow lightning icon in the toolbar. This opens a new window titled "Batch Run Configuration".

In the input field labelled VM Arguments, enter the following: -Xmx4512M
This will allow the model to use up to 4.5GB of memory (plus some Java overhead)

In order to correctly retrieve all generated output, you will need to add two entries to the Optional Output File Patterns. This is done by clicking the "Add" button. Enter the following entries:

Pattern: PersistentSpatialMemory*
Local Path: PersistentSpatialMemory.csv

Pattern: YearlyMortality*
Local Path: YearlyMortality.csv

Both should have Aggregate and Has Header checked.

Ensure that the "SSH Key Directory" is correct - it should be the directory with you SSH key(s) for the remote server(s).

You can now switch to the Batch Parameters tab to set up the parameters. The options for parameter values here is a bit different from the primary user interface. In the primary user interface, all the parameter values would be "Constant", which is also the default value in the Batch user interface. However, if you open the dropdown, you will find the options "Number Range" and "Space Separated List" as well. With these options, you can provide multiple values for one or more parameters. The parameter space will be unrolled automatically and all variations executed. Also notice that some values which can be selected with a dropdown in the primary user interface must be entered as string values here.
If you make any changes to the values, be sure to click on the "Generate" button before proceeding.

Now switch to the Hosts tab. This is where you configure you remote server.
Click the small "new file" icon (left most icon) above the list of hosts.
Change the Type to REMOTE and enter the user and hostname. If the SSH key is not stored in the default id_rsa then change that as applicable. In the Instances field, you can specify how many concurrent executions of your model this server should perform. The default value of 2 means that the executions will be performed simultaneously (if the parameter space requires multiple executions).

Since you do not wish to execute the model on your own computer, select the entry named "<user>@localhost" and select the delete icon (the red X).

You should now be ready to run the model remotely. Start the execution by clicking the green "run" button in the toolbar. This will switch to the console, which will display information on the model runs.

There is more information available on running Repast Simphony models in batch in the following document:

https://repast.github.io/docs/RepastBatchRunsGettingStarted.pdf

I hope this helps. Please post any additional questions you may have either as a reply in this thread (if related to this topic) or in a new thread.


RE: Running DEPONS on remote server - ida_carlen - 28-11-2020

Hello

Thanks for the detailed response.
I did follow your link and installed Git Client on my Windows 10 machine. I set up my SSH keys and did a successful connection to my remote host at ida@198.51.100.34 without password within Git Bash console.


I do have problems when doing the run from within Repast.
Code:
INFO  [SwingWorker-pool-2-thread-1] 18:52:37,010 repast.simphony.batch.ssh.RemoteSession -
Copying C:\Users\Ida\AppData\Local\Temp\ida_198.51.100.349034921661952833532.zip to
ida@198.51.100.34:~/simphony_model_1606585935650/ida_198.51.100.349034921661952833532.zip ...
ERROR [SwingWorker-pool-2-thread-1] 18:52:37,028 repast.simphony.batch.ssh.SessionsDriver - Error while creating connection to ida@198.51.100.34
Error while creating connection to ida@198.51.100.34

I also checked my ssh logs on remote machine and repast is not even trying to connect. Meaning it's failing before it is even trying.
Any recommendation how to find out why repast can not establish a SSH connection to a remote IPv4 address?


RE: Running DEPONS on remote server - jonasa - 07-12-2020

I have analyzed the issue. It seems to be related to the format of the SSH key generated by ssh-keygen.

The key has to be in the RSA format. The default format from ssh-keygen with Git Bash is OPENSSH.

There are several ways to fix this. Assuming that you are already using your id_rsa file for other servers, it may be recommendable to create a separate key for use with Repast. The "-m PEM" parameter is important here.

ssh-keygen -f /c/Users/Jonas/.ssh/id_repast -m PEM -t rsa

Replace "Jonas" in the path with your username.

The first line in the key file should be:

-----BEGIN RSA PRIVATE KEY-----

The public key can easily be authorized on the target server with ssh-copy-id:

ssh-copy-id -i ~/.ssh/id_repast <user>@<server>

After that, try logging into the server

ssh -i ~/.ssh/id_repast <user>@<server>

Although the Repast Simphony Batch Runs Getting Started guide states "Do not specify a passphrase." (in step four of section 2.3.2), I would generally recommend specifying a password for the private key. When using the password protected key in Repast Simphony, you will be prompted for the password.

Don't forget to change the default id_rsa key name in the Batch GUI if you choose to use another file name.


RE: Running DEPONS on remote server - ida_carlen - 08-12-2020

It works!
Really impressive that you found that the problem was wrong type of RSA key.
"ssh-keygen -m PEM -t rsa -f my_file" did solve my problem. Smile

On my remote linux host I also needed to add this to my /etc/ssh/sshd_config file:
Code:
#Legacy changes
KexAlgorithms +diffie-hellman-group1-sha1
And doing "systemctl restart ssh" after.

Thank you!


RE: Running DEPONS on remote server - jonasa - 10-12-2020

Very happy to hear that it works now.

Thank you very much for sharing details on the additional configuration as well!