php - automatically retrieve results of bsub -
i looking general advice rather coding solution. when submitting job via bsub can retrieve log of stdin/stdout specifying of following:
bsub -o log.txt % sends stdout log.txt bsub -u me@email % sends stdout email these both great, program creates folder when submitted bsub , stored on remote server. want
a) retrieve folder , it's contents b) automatically when job finishes
so technically using scp -r, have manually. not bad if email alert when job finished, still - i'd have manually this.
so onto b):
well can't see special flag bsub retreive actual results, stdout. suppose have script uses sleep , sets job time (perhaps bit linger safe), like
#!/bin/bash scp myfile.txt server:main/subfolder ssh bsub < myprogram.sh -u my@email sleep <job-time> scp -r server:main/subfolder result_folder however concerned being logged out etc , script terminating before job finished.
does have suggestions?
i want have interface (website in future) user can submit file, file analysed remotely, user sent emails when job starts/finishes, results automatically retrieved local/webserver, user gets email saying can pick results.
one step @ time though!
you can tar results directory stdout, logfile. un-tar logfile retrieve directory.
add tar czf - ... command end of script.
if have other stuff appearing on stdout first, move stderr instead, or echo unique string before tar, grep it, , tar there. here's sort of test of principle:
marker='#magic' # unique string log=/tmp/b # logfile echo 'test' >/tmp/a # tar test # -- in script, @ end -- # echo "$marker"; tar cf - /tmp/a # -- equivalent in test: (echo 'hello'; echo "$marker"; tar cf - /tmp/a) >$log # -- recover tar -- start=$(grep -ab "$marker" <$log | awk -f: '{print 1+$1+length($2)}') dd skip=1 bs=$start <$log | tar tvf - # use tar x
Comments
Post a Comment