Base class for connecting to an HPC machine via SSH.

Constructors

  • Parameters

    • hpcName: string

      hpc this connector will connect to

    • Optional job: Job

      job this connector is for

    • Optional emitLogFn: emitLogFnType

      callback for emitting logs

    • Optional emitEventFn: emitEventFnType

      callback for emitting events

    • env: Record<string, unknown> = {}

      environment to use when running commands

    Returns SSHConnector

Properties

emitEventFn?: emitEventFnType
emitLogFn?: emitLogFnType
envCmd: string = "#!/bin/bash\n"
hpcConfig: hpcConfig
hpcName: string
isCommunityAccount: boolean
job?: Job

Methods

  • creates an empty file at specified path

    Parameters

    • remotePath: string

      specified path with filename

    • options: options = {}

      dictionary with string options

    Returns Promise<null | string>

    command execution output

  • creates file with specified content

    Parameters

    • content: string | Record<string, unknown>

      file content (either string or dictionary)

    • remotePath: string

      destination path (where the file will be created on the remote machine)

    • _options: options = {}

      dictionary with string options (not used)

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event

    Returns Promise<void>

    Throws

    if file transfer of content to remote fails

  • Downloads the zip of a folder from the HPC to the local machine

    Parameters

    • fromRemote: string

      path of folder

    • toLocal: string

      name of the output file

    • muteEvent: boolean = false

      set to True if you want to mute maintainer emitted Event

    Returns Promise<void>

    Throws

    if exponentially backed off file transfer fails

  • Parameters

    • type: string

      type of event

    • message: string

      event message

    • muteEvent: boolean = false

      whether or not to suppress the event

    Returns void

  • Executes the command on the maintainer and returns the outpt

    Parameters

    • commands: string | string[]

      command/commands that need to be executed

    • options: options = {}

      execution options

    • muteEvent: boolean = true

      set to True if you want to mute maintauner emitted Event

    • muteLog: boolean = true

      set to True if you want to mute maintainer emitted Log

    • continueOnError: boolean = false

      set to True if you want the command/commands to continue despite errors

    Returns Promise<out>

    out - maintainer output

    Throws

    when the ssh command runs into an error; generally doesn't occur

  • creates directory at specified path

    Parameters

    • remotePath: string

      specified path with filename

    • Optional options: options = {}

      dictionary with string options

    • Optional muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event

    Returns Promise<null | string>

    command execution output

  • Determines whether a passed in (absolute) path exists on the HPC.

    Parameters

    • path: string

      path to test for

    • Optional options: options

      options for doing an exec

    Returns Promise<boolean>

    true if path exists; false if not

  • removes the file/folder at specified path

    Parameters

    • remotePath: string

      specified path with filename

    • options: options = {}

      options for the exec

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event

    Returns Promise<null | string>

    stdout from rm command

  • unzips the file/folder at specified path

    Parameters

    • fromRemote: string

      path to zipped file

    • toRemote: string

      destination folder to extract to

    • deleteZip: boolean = false

      whether or not to delete the zip file after unzipping

    • options: options = {}

      dictionary with string options

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event

    Returns Promise<null | string>

    command execution output

  • Uploads a file from the local machine to the target machine.

    Parameters

    • fromLocal: string

      input file string

    • toRemote: string

      output folder

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event (unused)

    Returns Promise<void>

    Throws

    • Thrown if maintainer emits 'SSH_SCP_DOWNLOAD_ERROR'
  • Uploads the zip of a folder from the local machine to the target machine.

    Parameters

    • fromLocal: string

      input file string

    • toRemote: string

      output folder

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event (unused)

    Returns Promise<void>

    Throws

    • Thrown if maintainer emits 'SSH_SCP_DOWNLOAD_ERROR'
  • zips the file/directory at specified path

    Parameters

    • fromRemote: string

      path of input file/directory (absolute) on the remote machine

    • toRemote: string

      path of the compressed file to create on the remote machine

    • options: options = {}

      dictionary with string options

    • muteEvent: boolean = false

      set to True if you want to mute maintauner emitted Event

    Returns Promise<null | string>

    command execution output

  • Public interface for constructing an sshconnector, has built-in validation that the ssh connection works.

    Parameters

    • hpcName: string

      hpc this connector will connect to

    • Optional job: Job

      job this connector is for

    • Optional emitLogFn: emitLogFnType

      callback for emitting logs

    • Optional emitEventFn: emitEventFnType

      callback for emitting events

    • env: Record<string, unknown> = {}

      environment to use when running commands

    Returns Promise<undefined | SSHConnector>

    the connector, or undefined if construction was unsuccessful

Generated using TypeDoc