-
Notifications
You must be signed in to change notification settings - Fork 80
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
fixes after 2022.04 #3199
fixes after 2022.04 #3199
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,26 @@ class Artifact(qdb.base.QiitaObject): | |
""" | ||
_table = "artifact" | ||
|
||
@classmethod | ||
def iter(cls): | ||
"""Iterate over all artifacts in the database | ||
|
||
Returns | ||
------- | ||
generator | ||
Yields a `Artifact` object for each artifact in the database, | ||
in order of ascending artifact_id | ||
""" | ||
with qdb.sql_connection.TRN: | ||
sql = """SELECT artifact_id FROM qiita.{} | ||
ORDER BY artifact_id""".format(cls._table) | ||
qdb.sql_connection.TRN.add(sql) | ||
|
||
ids = qdb.sql_connection.TRN.execute_fetchflatten() | ||
|
||
for id_ in ids: | ||
yield Artifact(id_) | ||
|
||
@classmethod | ||
def iter_by_visibility(cls, visibility): | ||
r"""Iterator over the artifacts with the given visibility | ||
|
@@ -79,17 +99,6 @@ def iter_by_visibility(cls, visibility): | |
for a_id in qdb.sql_connection.TRN.execute_fetchflatten(): | ||
yield cls(a_id) | ||
|
||
@classmethod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not used anywhere in the code. |
||
def iter_public(cls): | ||
r"""Iterator over the public artifacts available in the system | ||
|
||
Returns | ||
------- | ||
generator of qiita_db.artifact.Artifact | ||
The public artifacts available in the system | ||
""" | ||
return cls.iter_by_visibility('public') | ||
|
||
@staticmethod | ||
def types(): | ||
"""Returns list of all artifact types available and their descriptions | ||
|
@@ -615,12 +624,15 @@ def delete(cls, artifact_id): | |
qdb.util.move_filepaths_to_upload_folder( | ||
study.id, filepaths) | ||
|
||
sql = """UPDATE qiita.prep_template | ||
SET artifact_id = NULL | ||
WHERE prep_template_id IN %s""" | ||
qdb.sql_connection.TRN.add( | ||
sql, [tuple(pt.id for a in all_artifacts | ||
for pt in a.prep_templates)]) | ||
# there are cases that an artifact would not be linked to a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we have artifacts (like those generated by the sequencing processing pipeline) without prep/analysis linkages. |
||
# study | ||
pt_ids = [tuple([pt.id]) for a in all_artifacts | ||
for pt in a.prep_templates] | ||
if pt_ids: | ||
sql = """UPDATE qiita.prep_template | ||
SET artifact_id = NULL | ||
WHERE prep_template_id IN %s""" | ||
qdb.sql_connection.TRN.add(sql, pt_ids) | ||
else: | ||
sql = """DELETE FROM qiita.parent_artifact | ||
WHERE artifact_id IN %s""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,11 +532,7 @@ | |
</li> | ||
<li role="separator" class="divider"></li> | ||
<li> | ||
{% if qiita_sha=="" %} | ||
<a href="#"> | ||
{% else %} | ||
<a href="https://github.com/biocore/qiita/commit/{{qiita_sha}}"> | ||
{% end %} | ||
<a href="https://github.com/qiita-spots/qiita/releases"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should point to the releases page vs. the |
||
<h6> | ||
<b>Current version:</b></br> | ||
{{qiita_version}} {{qiita_sha[0:7]}} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,11 +43,8 @@ def _ssh_session(p_url, private_key): | |
""" | ||
scheme = p_url.scheme | ||
hostname = p_url.hostname | ||
# if port is '' Python 2.7.6 will raise an error | ||
try: | ||
port = p_url.port | ||
except Exception: | ||
port = 22 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ssh connection is currently broken due to newer python, this fixes it. |
||
port = p_url.port | ||
username = p_url.username | ||
|
||
if scheme == 'scp': | ||
|
@@ -61,8 +58,11 @@ def _ssh_session(p_url, private_key): | |
|
||
# step 2: connect to fileserver | ||
key = RSAKey.from_private_key_file(private_key) | ||
# we need pkeys now based on | ||
# https://github.com/paramiko/paramiko/issues/1961 | ||
pkeys = dict(pubkeys=['rsa-sha2-256', 'rsa-sha2-512']) | ||
ssh.connect(hostname, port=port, username=username, | ||
pkey=key, look_for_keys=False) | ||
pkey=key, look_for_keys=False, disabled_algorithms=pkeys) | ||
return ssh | ||
else: | ||
raise ValueError( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to iter over all Artifacts more often than before, thus this method.