diff --git a/qiita_db/processing_job.py b/qiita_db/processing_job.py
index e521b701d..a972576be 100644
--- a/qiita_db/processing_job.py
+++ b/qiita_db/processing_job.py
@@ -1974,7 +1974,7 @@ def from_default_workflow(cls, user, dflt_wf, req_params, name=None,
parent_ids.append(source_id)
# Get the connections between the job and the source
connections = data['connections'].connections
- for out, in_param in connections:
+ for out, in_param, _ in connections:
# We take advantage of the fact the parameters are
# stored in JSON to encode the name of the output
# artifact from the previous job
diff --git a/qiita_db/software.py b/qiita_db/software.py
index ae0ee6c3b..73824d7c3 100644
--- a/qiita_db/software.py
+++ b/qiita_db/software.py
@@ -1783,12 +1783,13 @@ def connections(self):
the destination command.
"""
with qdb.sql_connection.TRN:
- sql = """SELECT name, parameter_name
+ sql = """SELECT name, parameter_name, artifact_type
FROM qiita.default_workflow_edge_connections c
JOIN qiita.command_output o
ON c.parent_output_id = o.command_output_id
JOIN qiita.command_parameter p
ON c.child_input_id = p.command_parameter_id
+ LEFT JOIN qiita.artifact_type USING (artifact_type_id)
WHERE default_workflow_edge_id = %s"""
qdb.sql_connection.TRN.add(sql, [self.id])
return qdb.sql_connection.TRN.execute_fetchindex()
@@ -1832,8 +1833,8 @@ def iter(cls, active=True):
def active(self):
"""Retrieves active status of the default workflow
- Retruns
- ----------
+ Returns
+ -------
active : bool
active value
"""
@@ -1866,9 +1867,38 @@ def name(self):
qdb.sql_connection.TRN.add(sql, [self.id])
return qdb.sql_connection.TRN.execute_fetchlast()
+ @property
+ def description(self):
+ """Retrieves the description of the default workflow
+
+ Returns
+ -------
+ str
+ description value
+ """
+ with qdb.sql_connection.TRN:
+ sql = """SELECT description
+ FROM qiita.default_workflow
+ WHERE default_workflow_id = %s"""
+ qdb.sql_connection.TRN.add(sql, [self.id])
+ return qdb.sql_connection.TRN.execute_fetchlast()
+
+ @description.setter
+ def description(self, description):
+ """Changes the description of the default workflow
+
+ Parameters
+ ----------
+ description : str
+ New description value
+ """
+ sql = """UPDATE qiita.default_workflow SET description = %s
+ WHERE default_workflow_id = %s"""
+ qdb.sql_connection.perform_as_transaction(sql, [description, self._id])
+
@property
def data_type(self):
- """Retrieves all the data_types the workflow accepts
+ """Retrieves all the data_types accepted by the default workflow
Returns
----------
@@ -1897,7 +1927,8 @@ def graph(self):
# Retrieve all graph workflow nodes
sql = """SELECT default_workflow_node_id
FROM qiita.default_workflow_node
- WHERE default_workflow_id = %s"""
+ WHERE default_workflow_id = %s
+ ORDER BY default_workflow_node_id"""
qdb.sql_connection.TRN.add(sql, [self.id])
db_nodes = qdb.sql_connection.TRN.execute_fetchflatten()
@@ -1910,7 +1941,8 @@ def graph(self):
JOIN qiita.default_workflow_node n
ON e.parent_id = n.default_workflow_node_id
OR e.child_id = n.default_workflow_node_id
- WHERE default_workflow_id = %s"""
+ WHERE default_workflow_id = %s
+ ORDER BY default_workflow_edge_id"""
qdb.sql_connection.TRN.add(sql, [self.id])
db_edges = qdb.sql_connection.TRN.execute_fetchindex()
diff --git a/qiita_db/support_files/patches/81.sql b/qiita_db/support_files/patches/81.sql
index 00aaf8dde..9157be92d 100644
--- a/qiita_db/support_files/patches/81.sql
+++ b/qiita_db/support_files/patches/81.sql
@@ -10,7 +10,8 @@ ALTER TABLE qiita.prep_template ADD modification_timestamp TIMESTAMP DEFAULT CUR
-- a. Removing software_id from qiita.default_workflow and replacing it by a
-- table which will like different data_types with the default_workflow +
--- adding an active flag in case we need to deprecate default_workflows
+-- adding an active flag in case we need to deprecate default_workflows +
+-- adding a description column
ALTER TABLE qiita.default_workflow DROP software_id;
CREATE TABLE qiita.default_workflow_data_type (
default_workflow_id BIGINT NOT NULL,
@@ -20,6 +21,7 @@ CREATE TABLE qiita.default_workflow_data_type (
PRIMARY KEY(default_workflow_id, data_type_id)
);
ALTER TABLE qiita.default_workflow ADD active BOOL DEFAULT TRUE;
+ALTER TABLE qiita.default_workflow ADD description TEXT;
-- b. Removing command_id from qiita.default_workflow_node and default_parameter_set as this information
-- can be accessed via the default_parameter object (the info is duplicated)
@@ -37,3 +39,11 @@ INSERT INTO qiita.default_workflow_data_type (default_workflow_id, data_type_id)
(1, 2),
(2, 2),
(3, 3);
+
+-- d. adding descriptions
+UPDATE qiita.default_workflow
+ SET description = 'This accepts html Qiita!
BYE!'
+ WHERE default_workflow_id = 1;
+UPDATE qiita.default_workflow
+ SET description = 'This is another description'
+ WHERE default_workflow_id = 2;
diff --git a/qiita_db/support_files/qiita-db.dbs b/qiita_db/support_files/qiita-db.dbs
index 3d25c33b2..d1efe586f 100644
--- a/qiita_db/support_files/qiita-db.dbs
+++ b/qiita_db/support_files/qiita-db.dbs
@@ -526,6 +526,7 @@
Idx | Field Name | Data Type | active | boolean | +
---|---|---|
+ | description | +text | +
Indexes | ||
pk_default_workflow | ON default_workflow_id | diff --git a/qiita_db/test/test_software.py b/qiita_db/test/test_software.py index f50479bee..afd1f1524 100644 --- a/qiita_db/test/test_software.py +++ b/qiita_db/test/test_software.py @@ -609,6 +609,14 @@ def test_default_workflows(self): exp = ['18S'] self.assertEqual(obs, exp) + dw = qdb.software.DefaultWorkflow(1) + exp = ('This accepts html Qiita!' + '