# -*-Python-*-
# Created by bgrierson at 16 Oct 2017 16:15
"""
This script is a very simple executable that will be run in parallel by the ['PRUN']['basic'] script
"""
# The "code" is just a shell script that echos the working directory to a file
executable = '''
#!/bin/bash
pwd > pwd.txt
'''
# Set up to only run this code on the localhost (i.e. your workstation or laptop)
serverPicker = 'localhost'
serverOptions = SERVER[serverPicker]
server = serverOptions['server']
tunnel = serverOptions['tunnel']
remotedir = str(OMFITworkDir(root, serverPicker))
workdir = str(root['SETTINGS']['SETUP']['workDir'])
# Run the executable
OMFITx.executable(
root, inputs=[], outputs=['pwd.txt'], executable=executable, tunnel=None, server='localhost', workdir=workdir, remotedir=remotedir
)
# This location is a location that is referenced by the script that runs this executable
# If this script ex.py is run by itself, then we will create this output
# If this script ex.py is run by a .prun() then it will not appear in the tree
root['OUTPUTS'].setdefault('PRUN', OMFITtree())
root['OUTPUTS']['PRUN']['pwd'] = OMFITascii('./pwd.txt')