Running PyCharm Workspaces

Introduction

PyCharm Workspaces may require at least 2GiB of free RAM. Read more.

End Goal

  • Submit and manage PyCharm workspaces using the runai-bgu CLI.

  • Connect/disconnect/reconnect to your PyCharm workspace with ease.

Submitting a PyCharm Workspace

Example 1. Explicit resources
$ ssh bhn20 (1)
$ runai-bgu submit pycharm \ (2)
  -n my-workspace \ (3)
  -c 2 \ (4)
  -m 4Gi \ (5)
  -g 0.1 \ (6)
1 Configure SSH connection to bhn20
2 Specifies it is a PyCharm.
3 Specifies the name of the job.
4 Allocates 2 CPU cores.
5 Allocates 4GiB of memory*.
6 Specifies the GPU allocation(Whole or fractions). If you do not need GPU, do not use this flag.

You can also use a predefined resource template. Check out the guide for the template CLI Introduction.

Example 2. Using User Templates:
$ runai-bgu submit pycharm \ (1)
  -n my-workspace (2)
  --ut workspace-user (3)
1 Submit a pycharm workload
2 Specify the job name
3 Use the --ut specify the user template
Example 3. Using Group Templates:
$ runai-bgu submit pycharm \ (1)
  -n my-workspace (2)
  --ug workspace-group  (3)
1 Submit a pycharm workload
2 Specify the job name
3 Use the --ug specify the group template

Wait for Job to Start

The CLI will display messages about the job creation and port-forwarding status.

Example 4. Synopsis
Start job for remote development
$ ssh bhn20 (1)
$ runai-bgu submit pycharm -n my-workspace --ut workspace (2)
Waiting for workload to appear...
Waiting for workload to run...
SSH workspace pycharm is running. Setting up port forwarding to port <port-number>... (3)
1 Configure SSH connection to bhn20 manual.adoc[runai-bgu]
2 The port number is displayed in the terminal output after the SSH connection is established. Need to be set in the PyCharm Remote Development setup.

Open PyCharm and Connect

  • Launch PyCharm on your local machine.

  • From the Welcome Screen, navigate to Remote Development > SSH > Open Configured Project.

  • Select your configured project for bhn20.

  • If prompted, ensure the port matches the <port> value from step 2.

Verify Python Interpreter

After connecting, PyCharm should recognize the interpreter configured during the one-time setup.

Ending or Pausing Your Session

When you are done with your work or need to step away: When using workspaces the user has two choices when leaving the computer:

  1. Disconnect and delete the workspace: Use this method when the workspace is not necessary anymore and can be deleted.

    Example 5. Disconnect and delete workspace.

    In the terminal session where runai-bgu is running, type:

    $ stopall

    This will halt the port-forwarding and delete your workspace

  2. Background execution: Use this method when there is code running in the background/you are planning to return soon.

Keep in mind that if your workspace has GPUs allocated to it, the workspace will be deleted automatically after ~6 hours with no use of the GPU.
Example 6. Disconnect without deleting the job

In the terminal session where runai-bgu is running, type:

$ stop

This halts port-forwarding but keeps the job running.

Jobs in this state will be counted in you monthly bill.

Resuming your workspace

To resume your workspace, if the job is still running, re-do the steps from the submission command including the submission command.

If the job was stopped, you can resume it by running:

$ runai-bgu resume {job-name}

Then, re-do the steps from the submission command including the submission command.