Skip to content

fix #3455 #3459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions qiita_db/meta_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------
from os import stat, rename
from os import stat
from shutil import move
from os.path import join, relpath, basename
from time import strftime, localtime
import matplotlib.pyplot as plt
Expand All @@ -48,6 +49,8 @@
"sName", "sVersion", "cID", "cName", "processing_job_id",
"parameters", "samples", "columns", "input_size", "extra_info",
"MaxRSSRaw", "ElapsedRaw", "Start", "node_name", "node_model"]
RAW_DATA_ARTIFACT_TYPE = {
'SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger', 'per_sample_FASTQ'}


def _get_data_fpids(constructor, object_id):
Expand Down Expand Up @@ -118,9 +121,7 @@ def validate_filepath_access_by_user(user, filepath_id):

if artifact.visibility == 'public':
# TODO: https://github.com/biocore/qiita/issues/1724
if artifact.artifact_type in ['SFF', 'FASTQ', 'FASTA',
'FASTA_Sanger',
'per_sample_FASTQ']:
if artifact.artifact_type in RAW_DATA_ARTIFACT_TYPE:
study = artifact.study
has_access = study.has_access(user, no_public=True)
if (not study.public_raw_download and not has_access):
Expand Down Expand Up @@ -469,7 +470,7 @@ def generate_biom_and_metadata_release(study_status='public'):
for c in iter(lambda: f.read(4096), b""):
md5sum.update(c)

rename(tgz_name, tgz_name_final)
move(tgz_name, tgz_name_final)

vals = [
('filepath', tgz_name_final[len(working_dir):], r_client.set),
Expand Down Expand Up @@ -543,7 +544,7 @@ def generate_plugin_releases():
md5sum = md5()
for c in iter(lambda: f.read(4096), b""):
md5sum.update(c)
rename(tgz_name, tgz_name_final)
move(tgz_name, tgz_name_final)
vals = [
('filepath', tgz_name_final[len(working_dir):], r_client.set),
('md5sum', md5sum.hexdigest(), r_client.set),
Expand Down
1 change: 1 addition & 0 deletions qiita_db/support_files/populate_test_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ INSERT INTO qiita.artifact_type VALUES (5, 'per_sample_FASTQ', NULL, true, false
INSERT INTO qiita.artifact_type VALUES (7, 'BIOM', 'BIOM table', false, false, true);



--
-- Data for Name: data_type; Type: TABLE DATA; Schema: qiita; Owner: antoniog
--
Expand Down
8 changes: 5 additions & 3 deletions qiita_db/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from bcrypt import hashpw, gensalt
from functools import partial
from os.path import join, basename, isdir, exists, getsize
from os import walk, remove, listdir, rename, stat, makedirs
from os import walk, remove, listdir, stat, makedirs
from glob import glob
from shutil import move, rmtree, copy as shutil_copy
from openpyxl import load_workbook
Expand Down Expand Up @@ -542,7 +542,7 @@ def move_upload_files_to_trash(study_id, files_to_move):
new_fullpath = join(foldername, trash_folder, filename)

if exists(fullpath):
rename(fullpath, new_fullpath)
move(fullpath, new_fullpath)


def get_mountpoint(mount_type, retrieve_all=False, retrieve_subdir=False):
Expand Down Expand Up @@ -2297,7 +2297,9 @@ def send_email(to, subject, body):
msg = MIMEMultipart()
msg['From'] = qiita_config.smtp_email
msg['To'] = to
msg['Subject'] = subject.strip()
# we need to do 'replace' because the subject can have
# new lines in the middle of the string
msg['Subject'] = subject.replace('\n', '')
msg.attach(MIMEText(body, 'plain'))

# connect to smtp server, using ssl if needed
Expand Down
4 changes: 2 additions & 2 deletions qiita_pet/handlers/artifact_handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from qiita_db.processing_job import ProcessingJob
from qiita_db.util import get_visibilities, send_email
from qiita_db.logger import LogEntry
from qiita_db.meta_util import RAW_DATA_ARTIFACT_TYPE


PREP_TEMPLATE_KEY_FORMAT = 'prep_template_%s'
Expand Down Expand Up @@ -208,8 +209,7 @@ def artifact_summary_get_request(user, artifact_id):
# TODO: https://github.com/biocore/qiita/issues/1724 Remove this hardcoded
# values to actually get the information from the database once it stores
# the information
if artifact_type in ['SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger',
'per_sample_FASTQ']:
if artifact_type in RAW_DATA_ARTIFACT_TYPE:
# If the artifact is one of the "raw" types, only the owner of the
# study and users that has been shared with can see the files
study = artifact.study
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
install_requires=['psycopg2', 'click', 'bcrypt', 'pandas<2.0',
'biom-format', 'tornado<6.0', 'toredis', 'redis',
'scp', 'pyparsing', 'h5py', 'natsort', 'nose', 'pep8',
'networkx', 'humanize', 'wtforms<3.0.0', 'nltk<=3.8.1',
'networkx', 'humanize==4.11', 'wtforms<3.0.0',
'nltk<=3.8.1',
'openpyxl', 'sphinx-bootstrap-theme', 'Sphinx<3.0',
'gitpython', 'redbiom', 'pyzmq', 'sphinx_rtd_theme',
'paramiko', 'seaborn', 'matplotlib', 'scipy<=1.10.1',
Expand Down