Skip to content

Commit

Permalink
Fix tarball creation of entire project and email sender (#32)
Browse files Browse the repository at this point in the history
* fix tarfile creation

* fix typo in javascript

* fix run_analysis.py to create tar file correctly

* include in email body to not reply to this message
  • Loading branch information
Lioscro committed Mar 1, 2019
1 parent 88f54c0 commit 15d3f79
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/scripts/AlaskaProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ def prepare_submission(self):
Returns: None
"""
# Write the SOFT format seq_info.txt
out = 'seq_info.txt'
self.write_soft(out)

# Make a new archive.
geo_arch = '{}/{}'.format(self.dir, Alaska.GEO_ARCH)
with tarfile.open(geo_arch, 'w:gz') as tar:
Expand All @@ -309,10 +313,6 @@ def prepare_submission(self):
arcname = file
tar.add(full_path, arcname=arcname)

# Then, write the SOFT format seq_info.txt
out = 'seq_info.txt'
self.write_soft(out)

# Add the softfile.
full_path = '{}/{}'.format(self.dir, out)
tar.add(full_path, arcname=out)
Expand Down
8 changes: 5 additions & 3 deletions src/scripts/AlaskaServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ def send_email(self, to, subject, msg, _id):
datetime = (dt.datetime.now().strftime(Alaska.DATETIME_FORMAT)
+ ' Pacific Time')
url = 'http://alaska.caltech.edu:81/?id=' + _id
fr = 'noreply@alaska.caltech.edu'
fr = '{}@alaska.caltech.edu'.format(_id)

# Footer that is appended to every email.
if _id in self.ftp:
Expand All @@ -1083,7 +1083,8 @@ def send_email(self, to, subject, msg, _id):
FTP port: 21<br> \
FTP username: {}<br> \
FTP password: {}<br> \
This message was sent to {} at {}.</p> \
This message was sent to {} at {}.<br> \
<b>Please do not reply to this email.</b></p> \
</body> \
</html> \
'.format(msg, _id, url, url, _id, self.ftp[_id], to, datetime)
Expand All @@ -1097,7 +1098,8 @@ def send_email(self, to, subject, msg, _id):
<hr> \
<p>Project ID: {}<br> \
Unique URL: <a href="{}">{}</a><br> \
This message was sent to {} at {}.</p> \
This message was sent to {} at {}.<br> \
<b>Please do not reply to this email.</b></p> \
</body> \
</html> \
'.format(msg, _id, url, url, to, datetime)
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/run_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def archive(out, source_dir):
with tarfile.open(out, 'w:gz') as tar:
if isinstance(source_dir, str):
tar.add(source_dir, arcname=os.path.sep)
else:
elif isinstance(source_dir, list):
for d in source_dir:
tar.add(d, arcname=os.path.sep)
tar.add(d)

######### These functions must be here to allow multiprocessing.
def read_distribution(_id, bed_path):
Expand Down Expand Up @@ -459,7 +459,7 @@ def run_tea(d):
print_with_flush('# all analyses finished, archiving entire project')
dirs_to_archive = []
for d in os.listdir():
if d != '_temp' and d != '0_raw_reads' and not d.endswith('.tar.gz'):
if os.path.isdir(d) and d not in ['_temp', '0_raw_reads']:
dirs_to_archive.append(d)
archive(proj['id'] + '.tar.gz', dirs_to_archive)
print_with_flush('# done')
Expand Down
2 changes: 1 addition & 1 deletion src/web/html/assets/js/alaska_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function set_progress(status) {
set_progress_badge(elements.diff_status_badge, 'queued');
set_progress_bar_quant();
} else {
st_progress_bar_diff();
set_progress_bar_diff();
}

if (status >= progress.diff_finished) {
Expand Down

0 comments on commit 15d3f79

Please sign in to comment.