@@ -404,9 +404,8 @@ def test_descendants_with_jobs(self):
404
404
'"phred_offset": "auto"}' )
405
405
params = qdb .software .Parameters .load (qdb .software .Command (1 ),
406
406
json_str = json_str )
407
- user = qdb .
user .
User (
'[email protected] ' )
408
407
wf = qdb .processing_job .ProcessingWorkflow .from_scratch (
409
- user , params , name = 'Test WF' )
408
+ qdb . user . User ( '[email protected] ' ) ,
params ,
name = 'Test WF' )
410
409
parent = list (wf .graph .nodes ())[0 ]
411
410
wf .add (qdb .software .DefaultParameters (10 ),
412
411
connections = {parent : {'demultiplexed' : 'input_data' }})
@@ -699,6 +698,8 @@ def setUp(self):
699
698
700
699
self ._clean_up_files .extend ([self .fwd , self .rev ])
701
700
701
+ self .
user = qdb .
user .
User (
'[email protected] ' )
702
+
702
703
def tearDown (self ):
703
704
for f in self ._clean_up_files :
704
705
if exists (f ):
@@ -1039,7 +1040,7 @@ def test_delete_in_construction_job(self):
1039
1040
'"min_per_read_length_fraction": 0.75, "sequence_max_n": 0, '
1040
1041
'"phred_offset": ""}' % test .id )
1041
1042
qdb .processing_job .ProcessingJob .create (
1042
- qdb .
user . User ( '[email protected] ' ) ,
1043
+ self .user ,
1043
1044
qdb .software .Parameters .load (qdb .software .Command (1 ),
1044
1045
json_str = json_str ))
1045
1046
uploads_fp = join (qdb .util .get_mountpoint ("uploads" )[0 ][1 ],
@@ -1064,7 +1065,7 @@ def test_delete_error_running_job(self):
1064
1065
'"min_per_read_length_fraction": 0.75, "sequence_max_n": 0, '
1065
1066
'"phred_offset": ""}' % test .id )
1066
1067
job = qdb .processing_job .ProcessingJob .create (
1067
- qdb .
user . User ( '[email protected] ' ) ,
1068
+ self .user ,
1068
1069
qdb .software .Parameters .load (qdb .software .Command (1 ),
1069
1070
json_str = json_str ))
1070
1071
job ._set_status ('running' )
@@ -1147,7 +1148,7 @@ def test_delete_with_jobs(self):
1147
1148
'"min_per_read_length_fraction": 0.75, "sequence_max_n": 0, '
1148
1149
'"phred_offset": ""}' % test .id )
1149
1150
job = qdb .processing_job .ProcessingJob .create (
1150
- qdb .
user . User ( '[email protected] ' ) ,
1151
+ self .user ,
1151
1152
qdb .software .Parameters .load (qdb .software .Command (1 ),
1152
1153
json_str = json_str ))
1153
1154
job ._set_status ('success' )
@@ -1177,8 +1178,7 @@ def test_being_deleted_by(self):
1177
1178
cmd = qiita_plugin .get_command ('delete_artifact' )
1178
1179
params = qdb .software .Parameters .load (
1179
1180
cmd , values_dict = {'artifact' : test .id })
1180
- job = qdb .processing_job .ProcessingJob .create (
1181
- qdb .
user .
User (
'[email protected] ' ),
params ,
True )
1181
+ job = qdb .processing_job .ProcessingJob .create (self .user , params , True )
1182
1182
job ._set_status ('running' )
1183
1183
1184
1184
# verifying that there is a job and is the same than above
@@ -1189,8 +1189,7 @@ def test_being_deleted_by(self):
1189
1189
self .assertIsNone (test .being_deleted_by )
1190
1190
1191
1191
# now, let's actually remove
1192
- job = qdb .processing_job .ProcessingJob .create (
1193
- qdb .
user .
User (
'[email protected] ' ),
params ,
True )
1192
+ job = qdb .processing_job .ProcessingJob .create (self .user , params , True )
1194
1193
job .submit ()
1195
1194
# let's wait for job
1196
1195
wait_for_processing_job (job .id )
@@ -1207,7 +1206,7 @@ def test_delete_as_output_job(self):
1207
1206
data = {'OTU table' : {'filepaths' : [(fp , 'biom' )],
1208
1207
'artifact_type' : 'BIOM' }}
1209
1208
job = qdb .processing_job .ProcessingJob .create (
1210
- qdb .
user . User ( '[email protected] ' ) ,
1209
+ self .user ,
1211
1210
qdb .software .Parameters .load (
1212
1211
qdb .software .Command .get_validator ('BIOM' ),
1213
1212
values_dict = {'files' : dumps ({'biom' : [fp ]}),
@@ -1448,29 +1447,50 @@ def test_descendants_with_jobs(self):
1448
1447
data_type = "16S" )
1449
1448
self .assertEqual (len (a .analysis .artifacts ), 3 )
1450
1449
# 3. add jobs conencting the new artifact to the other root
1450
+ # - currently:
1451
1451
# a -> job -> b
1452
1452
# c
1453
- # job1 connects b & c
1454
- # job2 connects a & c
1453
+ # - expected:
1454
+ # a --> job -> b
1455
+ # |-> job2 -> out
1456
+ # ^
1457
+ # |-----|---> job1 -> out
1458
+ # c ------------|
1455
1459
cmd = qdb .software .Command .create (
1456
1460
qdb .software .Software (1 ),
1457
1461
"CommandWithMultipleInputs" , "" , {
1458
- 'input_b' : ['artifact:["BIOM"]' , None ],
1459
- 'input_c' : ['artifact:["BIOM"]' , None ]}, {'out' : 'BIOM' })
1460
- params = qdb .software .Parameters .load (
1461
- cmd , values_dict = {'input_b' : a .children [0 ].id , 'input_c' : c .id })
1462
- job1 = qdb .processing_job .ProcessingJob .create (
1463
- qdb .
user .
User (
'[email protected] ' ),
params )
1462
+ 'input_x' : ['artifact:["BIOM"]' , None ],
1463
+ 'input_y' : ['artifact:["BIOM"]' , None ]}, {'out' : 'BIOM' })
1464
1464
params = qdb .software .Parameters .load (
1465
- cmd , values_dict = {'input_b' : a .id , 'input_c' : c .id })
1466
- job2 = qdb .processing_job .ProcessingJob .create (
1467
- qdb .
user .
User (
'[email protected] ' ),
params )
1465
+ cmd , values_dict = {'input_x' : a .children [0 ].id , 'input_y' : c .id })
1466
+ wf = qdb .processing_job .ProcessingWorkflow .from_scratch (
1467
+ self .user , params , name = 'Test WF' )
1468
+ job1 = list (wf .graph .nodes ())[0 ]
1468
1469
1470
+ cmd_dp = qdb .software .DefaultParameters .create ("" , cmd )
1471
+ wf .add (cmd_dp , req_params = {'input_x' : a .id , 'input_y' : c .id })
1472
+ job2 = list (wf .graph .nodes ())[1 ]
1469
1473
jobs = [j [1 ] for e in a .descendants_with_jobs .edges
1470
1474
for j in e if j [0 ] == 'job' ]
1471
1475
self .assertIn (job1 , jobs )
1472
1476
self .assertIn (job2 , jobs )
1473
1477
1478
+ # 4. add job3 connecting job2 output with c as inputs
1479
+ # - expected:
1480
+ # a --> job -> b
1481
+ # |-> job2 -> out -> job3 -> out
1482
+ # ^ ^
1483
+ # | |
1484
+ # | |
1485
+ # |-----|---> job1 -> out
1486
+ # c ------------|
1487
+ wf .add (cmd_dp , connections = {
1488
+ job1 : {'out' : 'input_x' }, job2 : {'out' : 'input_y' }})
1489
+ job3 = list (wf .graph .nodes ())[2 ]
1490
+ jobs = [j [1 ] for e in a .descendants_with_jobs .edges
1491
+ for j in e if j [0 ] == 'job' ]
1492
+ self .assertIn (job3 , jobs )
1493
+
1474
1494
1475
1495
@qiita_test_checker ()
1476
1496
class ArtifactArchiveTests (TestCase ):
0 commit comments