From a0e6ad62b113955d98f11229da7993f9951142e8 Mon Sep 17 00:00:00 2001 From: avatar-lavventura Date: Thu, 13 Sep 2018 18:31:31 +0300 Subject: [PATCH] endCode some small updated related to find -delete line. --- endCode.py | 16 +++++++--------- lib.py | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/endCode.py b/endCode.py index 260633ed..1bda2e31 100755 --- a/endCode.py +++ b/endCode.py @@ -63,15 +63,11 @@ def receiptCheckTx(jobKey, index, elapsedRawTime, newHash, storageID, jobID): #{ def removeSourceCode(resultsFolderPrev): #{ # cmd: find . -type f ! -newer $resultsFolder/timestamp.txt # Client's loaded files are removed, no need to re-upload them. filesToRemove = subprocess.check_output(['find', '.', '-type', 'f', '!', '-newer', resultsFolderPrev + '/timestamp.txt']).decode('utf-8').strip() - log('Files to be removed: \n' + filesToRemove) + if filesToRemove is not '' or filesToRemove is not None: + log('\nFiles to be removed: \n' + filesToRemove + '\n') - # cmd: echo out | xargs rm -rf - p1 = subprocess.Popen(['echo', filesToRemove], stdout=subprocess.PIPE) - #----------- - p2 = subprocess.Popen(['xargs', 'rm', '-rf'], stdin=p1.stdout, stdout=subprocess.PIPE) - p1.stdout.close() - #----------- - p2.communicate() + # cmd: find . -type f ! -newer $resultsFolder/timestamp.txt -delete + subprocess.run(['find', '.', '-type', 'f', '!', '-newer', resultsFolderPrev + '/timestamp.txt', '-delete']) #} def endCall(jobKey, index, storageID, shareToken, folderName, jobID): #{ @@ -283,7 +279,9 @@ def endCall(jobKey, index, storageID, shareToken, folderName, jobID): #{ with open(resultsFolderPrev + '/modifiedDate.txt') as content_file: date = content_file.read().strip() - log(subprocess.check_output(['tar', '-N', date, '-jcvf', 'result-' + lib.CLUSTER_ID + '-' + str(index) + '.tar.gz'] + glob.glob("*")).decode('utf-8')) + log('Files to be archived using tar: \n' + + subprocess.check_output(['tar', '-N', date, '-jcvf', + 'result-' + lib.CLUSTER_ID + '-' + str(index) + '.tar.gz'] + glob.glob("*")).decode('utf-8')) ''' cmd: (https://stackoverflow.com/a/44556541/2402577, https://stackoverflow.com/a/24972004/2402577) curl -X PUT -H \'Content-Type: text/plain\' -H \'Authorization: Basic \'$encodedShareToken\'==\' \ diff --git a/lib.py b/lib.py index 72d422eb..e178aced 100755 --- a/lib.py +++ b/lib.py @@ -2,10 +2,10 @@ from colored import stylize from colored import fg -WHOAMI="alper" -EBLOCPATH="/home/alper/eBlocBroker" -CLUSTER_ID="0x4e4a0750350796164d8defc442a712b7557bf282" -GDRIVE="/usr/local/bin/gdrive" +WHOAMI="" +EBLOCPATH="" +CLUSTER_ID="" +GDRIVE="" RPC_PORT=8545 POA_CHAIN=1