Skip to content

RAVEN Development IDE Setup

Congjian Wang - INL edited this page Feb 15, 2024 · 8 revisions

Setting Up IDEs to Develop RAVEN

There are some common settings for some common IDEs that can make developing RAVEN easier. Here are some notes from our core development team who use the following IDEs.

VS Code

VS Code is a popular IDE with a rapidly growing user group. One if its main draws to RAVEN developers is online debugging and exploration of Python code during run time.

Setting up VS Code for RAVEN development includes installing a couple extensions, adding to the settings json, and extending the launch json.

Extensions

Particular extensions vary from user to user, but the following are commonly used (as of this writing):

  • XML Tools, by Josh Johnson, for better XML editing
  • Fold, by Felicio Mununga, for indent-based folding
  • GitLens -- Git supercharged, by Eric Amodio, for better git integration
  • Edit csv, by janisdd, for in-VS easy CSV viewing and editing

Settings (json)

You can edit the underlying settings.json file by using the Open Settings (JSON) command from the Command Palette (⇧⌘P). The following settings are commonly used, and can be added directly to the settings.json file either globally or for the RAVEN workspace:

    // RAVEN settings
    //disable opening of files as preview instead of editable
    "workbench.editor.enablePreview": false,
    "workbench.editor.enablePreviewFromQuickOpen": false,
    // lines should not exceed 100 characters, and may not exceed 120
    "editor.rulers": [100, 120],
    // navigation within code
    "breadcrumbs.enabled": true,
    // set the python path
    "python.pythonPath": "/Users/wangc/miniconda3/envs/raven_libraries/bin/",
    "python.defaultInterpreterPath": "/Users/wangc/miniconda3/envs/raven_libraries/bin/",
    // python linting (automatic checking) to be compatible with RAVEN
    // C0103: naming conventions in RAVEN are different than PEP8 standard, so disable this
    // C0301: line too long, while we have suggestions we don't enforce this rule, so disable this
    // W0511: TODOs in code comments, this is acceptable in RAVEN
    // R0902: too many instance attributes, we don't enforce this
    // R0914: too many local variables, we don't enforce this
    // E0401: path unresolved, generally this is handled by the importing structure of RAVEN
    // see more at e.g. http://pylint-messages.wikidot.com/all-codes
    "pylint.args": [
        "--disable=C0103,C0301,W0511,R0902,R0914,E0401",
        "--indent-string='  '",
        "--indent-after-paren=2"
    ],
    "python.languageServer": "Pylance",
    "editor.tabSize": 2,
    // associate XML and XSD as HTML files for the coloring and features
    "files.associations": {
        "*.xml": "html",
        "*.xsd": "html"
    },
    // standard file cleanup and formatting
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,

Launch (json)

VS Code allows launching python and using debugging tools. This allows us to set up launch configurations particularly for running RAVEN.

Add the following to the global or workspace launch.json file under configurations:

    { "name": "RAVEN",
      "type": "python",
      "request": "launch",
      "python": "${command:python.interpreterPath}",
      "program": "/Users/talbpw/projects/raven/raven_framework.py",
      // "cwd": "/Users/talbpw/projects/raven/tests/framework/ROM/TimeSeries/SyntheticHistory",
      // "args": ["fourier.xml"],
      "justMyCode": false,
      "args": ["${file}"]
    },

Then, by changing the cwd and args entries, different RAVEN inputs can be executed.

  • NOTE: The user paths must be changed from /Users/talbpw to the corresponding path on your machine!

Remote-SSH to INL HPC on VS Code

You can set up your local VS Code to ssh into Sawtooth HPC (or other clusters) and have access to files + create new terminals.

  1. Download the Remote-SSH extension from Microsoft in the VS Code Extensions Marketplace (CTRL+SHIFT+X).
  2. In your local PC (not HPC), find your C:/Users/<your_user_name/.ssh directory (or somewhere equivalent on MAC/Linux)
  3. Open or create a config.sh file in that folder
  4. Copy and Paste the following block into that file (I found these instructions in the INL MOOSE docs) :
     ## HPC Entry Point
     Host hpclogin hpclogin.inl.gov
       Hostname hpclogin.inl.gov
       DynamicForward 5555
    
     ## Forwarding
     Host sawtooth1 sawtooth2 lemhi1 lemhi2 rod hoodoo1 viz1
       ProxyJump hpclogin
  5. Now open a new remote-ssh session on VS Code:
    • CTRL+SHIFT+P
    • Type and click on Remote-SSH:Connect to Host
    • Type in <your_user_name_lowercase>@sawtooth1 (it'll ask for your INL HPC password) (this could also be some other cluster such as lemhi1)
    • Might ask for platform (it should be Linux)
  6. A new VS Code Window should open up connected to Sawtooth!
    • You can open a folder within your Sawtooth HPC directory, may ask for password again
    • You can also open new Terminal nodes from VS Code now