# parsl.channels.LocalChannel¶

class parsl.channels.LocalChannel(userhome='.', envs={}, script_dir=None)[source]

This is not even really a channel, since opening a local shell is not heavy and done so infrequently that they do not need a persistent channel

__init__(userhome='.', envs={}, script_dir=None)[source]

Initialize the local channel. script_dir is required by set to a default.

KwArgs:
• userhome (string): (default=’.’) This is provided as a way to override and set a specific userhome

• envs (dict) : A dictionary of env variables to be set when launching the shell

• script_dir (string): Directory to place scripts

Methods

 __init__([userhome, envs, script_dir]) Initialize the local channel. abspath(path) Return the absolute path. There’s nothing to close here, and this really doesn’t do anything execute_wait(cmd[, walltime, envs]) Synchronously execute a commandline string on the shell. isdir(path) Return true if the path refers to an existing directory. makedirs(path[, mode, exist_ok]) Create a directory. pull_file(remote_source, local_dir) Transport file on the remote side to a local directory push_file(source, dest_dir) If the source files dirpath is the same as dest_dir, a copy is not necessary, and nothing is done.

Attributes

 script_dir This is a property.
abspath(path)[source]

Return the absolute path.

Parameters

path (str) – Path for which the absolute path will be returned.

close()[source]

There’s nothing to close here, and this really doesn’t do anything

Returns

• False, because it really did not “close” this channel.

execute_wait(cmd, walltime=None, envs={})[source]

Synchronously execute a commandline string on the shell.

Parameters
• cmd (-) – Commandline string to execute

• walltime (-) – walltime in seconds, this is not really used now.

Kwargs:
• envs (dict) : Dictionary of env variables. This will be used to override the envs set at channel initialization.

Returns

Return code from the execution, -1 on fail - stdout : stdout string - stderr : stderr string

Return type

• retcode

Raises: None.

isdir(path)[source]

Return true if the path refers to an existing directory.

Parameters

path (str) – Path of directory to check.

makedirs(path, mode=511, exist_ok=False)[source]

Create a directory.

If intermediate directories do not exist, they will be created.

Parameters
• path (str) – Path of directory to create.

• mode (int) – Permissions (posix-style) for the newly-created directory.

• exist_ok (bool) – If False, raise an OSError if the target directory already exists.

pull_file(remote_source, local_dir)[source]

Transport file on the remote side to a local directory

Parameters
• remote_source (string) – remote_source

• local_dir (string) – Local directory to copy to

Returns

destination_path (string)

push_file(source, dest_dir)[source]

If the source files dirpath is the same as dest_dir, a copy is not necessary, and nothing is done. Else a copy is made.

Parameters
• source (-) – Path to the source file

• dest_dir (-) – Path to the directory to which the files is to be copied

Returns

Absolute path of the destination file

Return type

• destination_path (String)

Raises

- FileCopyException – If file copy failed.

property script_dir[source]

This is a property. Returns the directory assigned for storing all internal scripts such as scheduler submit scripts. This is usually where error logs from the scheduler would reside on the channel destination side.

Parameters

None (-) –

Returns

• Channel script dir