diff --git a/src/AS_UTL/objectStore.C b/src/AS_UTL/objectStore.C index 6df7cf2aa..cfaab94d3 100644 --- a/src/AS_UTL/objectStore.C +++ b/src/AS_UTL/objectStore.C @@ -29,6 +29,7 @@ #include "splitToWords.H" #include +#include static @@ -235,12 +236,25 @@ fetchFromObjectStore(char *requested) { fprintf(stderr, "fetchFromObjectStore()-- found path '%s'\n", path); char *cmd = new char [FILENAME_MAX+1]; - - snprintf(cmd, FILENAME_MAX, "%s download --output \"%s\" \"%s:%s/%s\"", dx, requested, pr, ns, path); + snprintf(cmd, FILENAME_MAX, "%s:%s/%s", pr, ns, path); + char *args[8] = {"dx", "download", "--overwrite", "--no-progress", "--output", "", "", (char*)0}; + args[5] = requested; + args[6] = cmd; fprintf(stderr, "fetchFromObjectStore()-- executing '%s'\n", cmd); - int32 err = system(cmd); + int32 err; + int32 pid = vfork(); + if ( pid == -1) + fprintf(stderr, "vfork failed with error '%s'.\n", strerror(errno)); + + if ( pid == 0 ) { + execve(dx, args, environ); + fprintf(stderr, "execve failed with error '%s'.\n", strerror(errno)); + _exit(-1); + } + waitpid(-1, (int*)&err, 0); + err = WEXITSTATUS(err); if (err == 127) fprintf(stderr, "Failed to execute '%s'.\n", cmd), exit(1); diff --git a/src/dx-canu/src/canu.sh b/src/dx-canu/src/canu.sh index ed1d1a73f..981e964d7 100755 --- a/src/dx-canu/src/canu.sh +++ b/src/dx-canu/src/canu.sh @@ -98,7 +98,8 @@ main() { if [ ! -s ${output_prefix}.contigs.fasta ]; then # save the command without the inputs - echo "canu executiveMemory=8 executiveThreads=2 objectStore=DNANEXUS objectStoreClient=dx objectStoreNameSpace=$output_path objectStoreProject=$DX_PROJECT_CONTEXT_ID -d . -p ${output_prefix} genomeSize=${genome_size} $parameters" > canu.sh + dx_command=`which dx` + echo "canu executiveMemory=8 executiveThreads=2 objectStore=DNANEXUS objectStoreClient=$dx_command objectStoreNameSpace=$output_path objectStoreProject=$DX_PROJECT_CONTEXT_ID -d . -p ${output_prefix} genomeSize=${genome_size} $parameters" > canu.sh # bash is set to quit in the app on any error (including file doesn't exist) so we only run rm on success of describe, otherwise nothing exists=`dx describe --name $DX_PROJECT_CONTEXT_ID:$output_path/canu.sh || true` if [[ -e canu.sh && x$exists != x ]] ; then @@ -107,6 +108,6 @@ main() { dx upload --wait --parents --path $DX_PROJECT_CONTEXT_ID:$output_path/canu.sh canu.sh # run the canu command - canu executiveMemory=8 executiveThreads=2 objectStore=DNANEXUS objectStoreClient=dx objectStoreNameSpace=$output_path objectStoreProject=$DX_PROJECT_CONTEXT_ID -d . -p ${output_prefix} genomeSize=${genome_size} $parameters ${input_type} ${input_files_name[@]} + canu executiveMemory=8 executiveThreads=2 objectStore=DNANEXUS objectStoreClient=$dx_command objectStoreNameSpace=$output_path objectStoreProject=$DX_PROJECT_CONTEXT_ID -d . -p ${output_prefix} genomeSize=${genome_size} $parameters ${input_type} ${input_files_name[@]} fi } diff --git a/src/pipelines/canu/Grid_DNANexus.pm b/src/pipelines/canu/Grid_DNANexus.pm index 925658909..a378ec2c1 100644 --- a/src/pipelines/canu/Grid_DNANexus.pm +++ b/src/pipelines/canu/Grid_DNANexus.pm @@ -72,7 +72,7 @@ sub buildAvailableNodeList() { my @v = split '\|', $_; my $cpus = $v[$cpuIdx]; - my $mem = $v[$memIdx]; + my $mem = $v[$memIdx] * 0.85; # the machines don't have swap so save some space for OS overhead my $name = $v[$nameIdx]; $mem = int($mem);