File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -754,6 +754,26 @@ def resource_allocation(self):
754
754
755
755
return result [0 ]
756
756
757
+ @property
758
+ def processing_jobs (self ):
759
+ """All the processing_jobs that used this command
760
+
761
+ Returns
762
+ -------
763
+ list of qiita_db.processing_job.ProcessingJob
764
+ List of jobs that used this command.
765
+ """
766
+
767
+ with qdb .sql_connection .TRN :
768
+ sql = """SELECT processing_job_id FROM
769
+ qiita.processing_job
770
+ WHERE command_id = %s"""
771
+ qdb .sql_connection .TRN .add (sql , [self .id ])
772
+
773
+ jids = qdb .sql_connection .TRN .execute_fetchflatten ()
774
+
775
+ return [qdb .processing_job .ProcessingJob (j ) for j in jids ]
776
+
757
777
758
778
class Software (qdb .base .QiitaObject ):
759
779
r"""A software package available in the system
Original file line number Diff line number Diff line change @@ -464,6 +464,23 @@ def test_activate(self):
464
464
tester .activate ()
465
465
self .assertTrue (tester .active )
466
466
467
+ def test_processing_jobs (self ):
468
+ exp_jids = ['6d368e16-2242-4cf8-87b4-a5dc40bb890b' ,
469
+ '4c7115e8-4c8e-424c-bf25-96c292ca1931' ,
470
+ 'b72369f9-a886-4193-8d3d-f7b504168e75' ,
471
+ '46b76f74-e100-47aa-9bf2-c0208bcea52d' ,
472
+ '6ad4d590-4fa3-44d3-9a8f-ddbb472b1b5f' ,
473
+ '063e553b-327c-4818-ab4a-adfe58e49860' ,
474
+ 'ac653cb5-76a6-4a45-929e-eb9b2dee6b63' ]
475
+ exp = [qdb .processing_job .ProcessingJob (j ) for j in exp_jids ]
476
+ self .assertCountEqual (qdb .software .Command (1 ).processing_jobs , exp )
477
+
478
+ exp_jids = ['bcc7ebcd-39c1-43e4-af2d-822e3589f14d' ]
479
+ exp = [qdb .processing_job .ProcessingJob (j ) for j in exp_jids ]
480
+ self .assertCountEqual (qdb .software .Command (2 ).processing_jobs , exp )
481
+
482
+ self .assertCountEqual (qdb .software .Command (4 ).processing_jobs , [])
483
+
467
484
468
485
@qiita_test_checker ()
469
486
class SoftwareTestsIter (TestCase ):
You can’t perform that action at this time.
0 commit comments