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