Example #1
0
remote.setup(arguments.remote)

for path in fs.files_in_path(fs.cwd(), extension="sim"):

    # Create simulation
    sim = RemoteSimulation.from_file(path)

    if not sim.retrieved: continue

    local_output_path = sim.output_path

    remote_simulation_path = sim.remote_simulation_path
    remote_output_path = sim.remote_output_path
    remote_input_path = sim.remote_input_path

    if not remote.is_directory(remote_simulation_path):
        remote.create_directory(remote_simulation_path)
    if not remote.is_directory(remote_output_path):
        remote.create_directory(remote_output_path)

    for filepath in fs.files_in_path(local_output_path):
        remote.upload(filepath, remote_output_path, show_output=True)

    sim.retrieved = False

    if arguments.keep: sim.remove_remote_output = False

    sim.save()

# -----------------------------------------------------------------
# Remotely
if config.remote is not None:

    # Create the remote
    remote = Remote()

    # Setup the remote
    remote.setup(config.remote)

    # Remove specification of the remote
    arguments_no_remote = arguments[:-2]

    # Make a new temporary directory remotely
    remote_path = fs.join(remote.home_directory, temp_name)
    remote.create_directory(remote_path)
    remote.change_cwd(remote_path)

    # Send the appropriate command
    remote.launch_pts_command("get_poisson_errors", arguments_no_remote)

    # Retrieve the remote directory
    remote.download(remote_path, fs.cwd(), show_output=True)
    local_path = fs.join(fs.cwd(), fs.name(remote_path))

    # Remove the temporary remote directory
    remote.remove_directory(remote_path)

# Locally
else:
Example #3
0
# Remotely
if config.remote is not None:

    # Create the remote
    remote = Remote()

    # Setup the remote
    remote.setup(config.remote)

    # Remove specification of the remote
    arguments_no_remote = arguments[:-2]

    # Make a new temporary directory remotely
    remote_path = fs.join(remote.home_directory, temp_name)
    remote.create_directory(remote_path)
    remote.change_cwd(remote_path)

    # Send the appropriate command
    remote.launch_pts_command("get_poisson_errors", arguments_no_remote)

    # Retrieve the remote directory
    remote.download(remote_path, fs.cwd(), show_output=True)
    local_path = fs.join(fs.cwd(), fs.name(remote_path))

    # Remove the temporary remote directory
    remote.remove_directory(remote_path)

# Locally
else:
Example #4
0
# Create the remote execution environment
remote = Remote()
remote.setup(arguments.remote)

for path in fs.files_in_path(fs.cwd(), extension="sim"):
    
    # Create simulation
    sim = RemoteSimulation.from_file(path)
    
    if not sim.retrieved: continue
    
    local_output_path = sim.output_path
    
    remote_simulation_path = sim.remote_simulation_path
    remote_output_path = sim.remote_output_path
    remote_input_path = sim.remote_input_path
    
    if not remote.is_directory(remote_simulation_path): remote.create_directory(remote_simulation_path)
    if not remote.is_directory(remote_output_path): remote.create_directory(remote_output_path)

    for filepath in fs.files_in_path(local_output_path):
        remote.upload(filepath, remote_output_path, show_output=True)
    
    sim.retrieved = False
    
    if arguments.keep: sim.remove_remote_output = False
    
    sim.save()

# -----------------------------------------------------------------