SSHComputingElement

SSH (Virtual) Computing Element

For a given IP/host it will send jobs directly through ssh

Configuration Parameters

Configuration for the SSHComputingElement submission can be done via the configuration system.

BatchSystem:

Underlying batch system that is going to be used to orchestrate executable files. The Batch System has to be accessible from the LocalCE. By default, the LocalComputingElement submits directly on the host via the Host class.

ParallelLibrary:

Underlying parallel library used to generate a wrapper around the executable files to run them in parallel on multiple nodes.

SharedArea:

Area used to store executable/output/error files if they are not aready defined via BatchOutput, BatchError, InfoArea, ExecutableArea and/or WorkArea. The path should be absolute.

BatchOutput:

Area where the job outputs are stored. If not defined: SharedArea + ‘/data’ is used. If not absolute: SharedArea + path is used.

BatchError:

Area where the job errors are stored. If not defined: SharedArea + ‘/data’ is used. If not absolute: SharedArea + path is used.

ExecutableArea:

Area where the executable files are stored if necessary: this is the case when a parallel library is used. Indeed, the executable has to be accessible to the batch system. This might not be the case if multiple file systems are present on the host. If not defined: SharedArea + ‘/data’ is used. If not absolute: SharedArea + path is used.

SSHHost:

SSH host name

SSHUser:

SSH user login

SSHPassword:

SSH password

SSHPort:

Port number if not standard, e.g. for the gsissh access

SSHKey:

Location of the ssh private key for no-password connection

SSHOptions:

Any other SSH options to be used

SSHTunnel:

String defining the use of intermediate SSH host. Example:

ssh -i /private/key/location -l final_user final_host
SSHType:

SSH (default) or gsissh

Code Documentation

class DIRAC.Resources.Computing.SSHComputingElement.SSH(host=None, parameters=None)

Bases: object

SSH class encapsulates passing commands and files through an SSH tunnel to a remote host. It can use either ssh or gsissh access. The final host where the commands will be executed and where the files will copied/retrieved can be reached through an intermediate host if SSHTunnel parameters is defined.

SSH constructor parameters are defined in a SSH accessible Computing Element in the Configuration System:

  • SSHHost: SSH host name

  • SSHUser: SSH user login

  • SSHPassword: SSH password

  • SSHPort: port number if not standard, e.g. for the gsissh access

  • SSHKey: location of the ssh private key for no-password connection

  • SSHOptions: any other SSH options to be used

  • SSHTunnel: string defining the use of intermediate SSH host. Example:

    ‘ssh -i /private/key/location -l final_user final_host’

  • SSHType: ssh ( default ) or gsissh

The class public interface includes two methods:

sshCall( timeout, command_sequence ) scpCall( timeout, local_file, remote_file, upload = False/True )

__init__(host=None, parameters=None)
scpCall(timeout, localFile, remoteFile, postUploadCommand='', upload=True)

Perform file copy through an SSH magic.

Parameters
  • timeout (int) – timeout of the command

  • localFile (str) – local file path, serves as source for uploading and destination for downloading. Can take ‘Memory’ as value, in this case the downloaded contents is returned as result[‘Value’]

  • remoteFile (str) – remote file full path

  • postUploadCommand (str) – command executed on the remote side after file upload

  • upload (bool) – upload if True, download otherwise

sshCall(timeout, cmdSeq)

Execute remote command via a ssh remote call

Parameters
  • timeout (int) – timeout of the command

  • cmdSeq (list) – list of command components

class DIRAC.Resources.Computing.SSHComputingElement.SSHComputingElement(ceUniqueID)

Bases: DIRAC.Resources.Computing.ComputingElement.ComputingElement

__init__(ceUniqueID)

Standard constructor.

available(jobIDList=None)

This method returns the number of available slots in the target CE. The CE instance polls for waiting and running jobs and compares to the limits in the CE parameters.

Parameters

jobIDList (list) – list of already existing job IDs to be checked against

getCEStatus()

Method to return information on running and pending jobs.

getDescription()

Get CE description as a dictionary.

This is called by the JobAgent for the case of “inner” CEs.

getJobOutput(jobID, localDir=None)

Get the specified job standard output and error files. If the localDir is provided, the output is returned as file in this directory. Otherwise, the output is returned as strings.

getJobStatus(jobIDList)

Get the status information for the given list of jobs

initializeParameters()

Initialize the CE parameters after they are collected from various sources

isProxyValid(valid=1000)

Check if the stored proxy is valid

isValid()

Check the sanity of the Computing Element definition

killJob(jobIDList)

Kill a bunch of jobs

loadBatchSystem(batchSystemName)

Instantiate object representing the backend batch system

Parameters

batchSystemName (str) – name of the batch system

loadParallelLibrary(parallelLibraryName, workingDirectory='.')

Instantiate object representing the parallel library that will generate a script to wrap the executable

Parameters

parallelLibraryName (str) – name of the parallel library

sendOutput(stdid, line)

Callback function such that the results from the CE may be returned.

setCPUTimeLeft(cpuTimeLeft=None)

Update the CPUTime parameter of the CE classAd, necessary for running in filling mode

setParameters(ceOptions)

Add parameters from the given dictionary overriding the previous values

Parameters

ceOptions (dict) – CE parameters dictionary to update already defined ones

setProxy(proxy, valid=0)

Set and prepare proxy to use

Parameters
  • proxy (str) – proxy to use

  • valid (int) – proxy validity period

Returns

S_OK/S_ERROR

shutdown()

Optional method to shutdown the (Inner) Computing Element

submitJob(executableFile, proxy, numberOfJobs=1)

Method to submit job, should be overridden in sub-class.

writeProxyToFile(proxy)

CE helper function to write a CE proxy string to a file.