Add option to suppress storage copy for testing
This commit is contained in:
@@ -11,6 +11,7 @@ namespace LeafWeb.Core.Remote
|
||||
public int LeafInputId { get; set; }
|
||||
public string PhotosyntheticType { get; set; }
|
||||
public string DirectoryName { get; set; }
|
||||
public bool SuppressStorageCopy { get; set; }
|
||||
public PiscalLeafInputFile[] InputFiles { get; set; }
|
||||
|
||||
static PiscalLeafInput()
|
||||
|
||||
@@ -69,6 +69,10 @@ namespace LeafWeb.Core.Remote
|
||||
{
|
||||
ssh.Connect();
|
||||
var commandText = $"{RemoteScriptPath} -d {leafInput.DirectoryName} -p {leafInput.PhotosyntheticType} -s";
|
||||
|
||||
if (leafInput.SuppressStorageCopy)
|
||||
commandText += " -t";
|
||||
|
||||
var command = ssh.CreateCommand(commandText);
|
||||
command.Execute();
|
||||
ssh.Disconnect();
|
||||
|
||||
@@ -7,6 +7,7 @@ where:
|
||||
-h show this help text
|
||||
-d working directory
|
||||
-f input filename
|
||||
-t suppress storage copy
|
||||
-u url to notify on completion"
|
||||
|
||||
# http://stackoverflow.com/a/246128/99492
|
||||
@@ -23,7 +24,7 @@ notify_url=""
|
||||
# $piscal_executable and $storage_directory
|
||||
. "$base_directory/piscal_launcher.cfg"
|
||||
|
||||
while getopts "hd:f:u:" opt; do
|
||||
while getopts "hd:f:u:t" opt; do
|
||||
case "$opt" in
|
||||
h )
|
||||
echo "$usage"
|
||||
@@ -32,6 +33,9 @@ while getopts "hd:f:u:" opt; do
|
||||
d )
|
||||
working_directory=$OPTARG
|
||||
;;
|
||||
t )
|
||||
suppress_storage_copy=true
|
||||
;;
|
||||
u )
|
||||
notify_url=$OPTARG
|
||||
;;
|
||||
@@ -93,8 +97,10 @@ fi
|
||||
popd >> /dev/null
|
||||
|
||||
# copy output to storage
|
||||
cp "$output_directory_touser"/* "$storage_directory"/
|
||||
cp "$output_directory_nottouser"/* "$storage_directory"/
|
||||
if [ -z "$suppress_storage_copy" ]; then
|
||||
cp "$output_directory_touser"/* "$storage_directory"/
|
||||
cp "$output_directory_nottouser"/* "$storage_directory"/
|
||||
fi
|
||||
|
||||
# notify given url of completion
|
||||
if [ -z "$notify_url" ]; then
|
||||
|
||||
@@ -8,6 +8,7 @@ where:
|
||||
-d working directory name
|
||||
-p photosynthetic type
|
||||
-s start job
|
||||
-t suppress storage copy
|
||||
-c cleanup directory
|
||||
-k kill job"
|
||||
|
||||
@@ -27,7 +28,7 @@ launcher="$base_directory/piscal_launcher.sh"
|
||||
# http://stackoverflow.com/a/14203146/99492
|
||||
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
||||
|
||||
while getopts "hd:f:p:sck" opt; do
|
||||
while getopts "hd:f:p:stck" opt; do
|
||||
#echo "$opt = $OPTARG"
|
||||
case "$opt" in
|
||||
h )
|
||||
@@ -43,6 +44,9 @@ while getopts "hd:f:p:sck" opt; do
|
||||
s )
|
||||
task="launch"
|
||||
;;
|
||||
t )
|
||||
suppress_storage_copy=true
|
||||
;;
|
||||
c )
|
||||
task="cleanup"
|
||||
;;
|
||||
@@ -75,6 +79,7 @@ pid_path="$working_directory/$pid_filename"
|
||||
|
||||
## Process task
|
||||
if [ "$task" = "launch" ]; then
|
||||
# TODO: verify process isn't running yet
|
||||
piscal_config_file="$working_directory"/piscal.cfg
|
||||
# write config file for piscal
|
||||
echo $photosynthetic_type > "$piscal_config_file"
|
||||
@@ -83,6 +88,9 @@ if [ "$task" = "launch" ]; then
|
||||
>> "$piscal_config_file"
|
||||
|
||||
command="$launcher -d $working_directory -f piscal.cfg"
|
||||
if [ "$suppress_storage_copy" = true ]; then
|
||||
command="$command -t"
|
||||
fi
|
||||
# launch it, sending error output to file
|
||||
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ namespace LeafWeb.Web.Services.PiscalQueue
|
||||
public void Run(LeafInput leafInput)
|
||||
{
|
||||
var inputFile = new PiscalLeafInput(leafInput);
|
||||
// TODO: remove this, just for testing
|
||||
if (string.Equals(leafInput.Email, "james.kolpack@gmail.com", StringComparison.InvariantCultureIgnoreCase))
|
||||
inputFile.SuppressStorageCopy = true;
|
||||
_piscalClient.RunLeafInput(inputFile);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user