Skip to content

Commit

Permalink
endCode some small updated related to find -delete line.
Browse files Browse the repository at this point in the history
  • Loading branch information
avatar-lavventura committed Sep 13, 2018
1 parent e8c0589 commit a0e6ad6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 7 additions & 9 deletions endCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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): #{
Expand Down Expand Up @@ -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\'==\' \
Expand Down
8 changes: 4 additions & 4 deletions lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a0e6ad6

Please sign in to comment.