|
1 | 1 | # ----------------------------------------------------------------------------- |
| 2 | + pp = qdb.software.Parameters(parameters_id) |
2 | 3 | # Copyright (c) 2014--, The Qiita Development Team. |
3 | 4 | # |
4 | 5 | # Distributed under the terms of the BSD 3-clause License. |
@@ -186,16 +187,28 @@ def post(self): |
186 | 187 | analysis = self.get_argument('analysis', None) |
187 | 188 | name = self.get_argument('name', None) |
188 | 189 | dtype = self.get_argument('data_type', None) |
| 190 | + parents = self.get_argument('parents', None) |
| 191 | + job_id = self.get_argument('job_id', None) |
189 | 192 |
|
190 | 193 | if prep_template is not None: |
191 | 194 | prep_template = qdb.metadata_template.prep_template.PrepTemplate( |
192 | 195 | prep_template) |
193 | 196 | dtype = None |
194 | 197 | if analysis is not None: |
195 | 198 | analysis = qdb.analysis.Analysis(analysis) |
| 199 | + if parents is not None: |
| 200 | + # remember that this method is only accessed via the tests so |
| 201 | + # to load an artifact with parents, the easiest it to use |
| 202 | + # the job_id that is being used for testing and passed as a |
| 203 | + # parameter |
| 204 | + parents = [qdb.artifact.Artifact(p) for p in loads(parents)] |
| 205 | + pp = qdb.processing_job.ProcessingJob(job_id).parameters |
| 206 | + else: |
| 207 | + pp = None |
196 | 208 |
|
197 | 209 | a = qdb.artifact.Artifact.create( |
198 | 210 | filepaths, artifact_type, name=name, prep_template=prep_template, |
| 211 | + parents=parents, processing_parameters=pp, |
199 | 212 | analysis=analysis, data_type=dtype) |
200 | 213 |
|
201 | 214 | self.write({'artifact': a.id}) |
|
0 commit comments