@@ -138,24 +138,25 @@ def eval_rule(rule, file_, container):
138138
139139 return True
140140
141- def queue_job_legacy (algorithm_id , input_ ):
141+ def queue_job_legacy (gear_id , input_ ):
142142 """
143143 Tie together logic used from the no-manifest, single-file era.
144144 Takes a single FileReference instead of a map.
145145 """
146146
147- gear = gears .get_gear_by_name ( algorithm_id )
147+ gear = gears .get_gear ( gear_id )
148148
149149 if len (gear ['gear' ]['inputs' ]) != 1 :
150- raise Exception ("Legacy gear enqueue attempt of " + algorithm_id + " failed: must have exactly 1 input in manifest" )
150+ raise Exception ("Legacy gear enqueue attempt of " + gear_id + " failed: must have exactly 1 input in manifest" )
151151
152152 input_name = gear ['gear' ]['inputs' ].keys ()[0 ]
153153
154154 inputs = {
155155 input_name : input_
156156 }
157157
158- job = Job (str (gear ['_id' ]), inputs , tags = ['auto' , algorithm_id ])
158+ gear_tag = gear ['gear' ]['name' ] + '-' + gear_id
159+ job = Job (str (gear ['_id' ]), inputs , tags = ['auto' , gear_tag ])
159160 return job
160161
161162def find_type_in_container (container , type_ ):
@@ -184,22 +185,23 @@ def create_potential_jobs(db, container, container_type, file_):
184185
185186 if 'from_failed_job' not in file_ and eval_rule (rule , file_ , container ):
186187
187- alg_name = rule ['alg' ]
188+ gear_id = rule ['gear_id' ]
189+ gear = gears .get_gear (gear_id )
190+ gear_tag = gear ['gear' ]['name' ] + '-' + gear_id
188191
189192 if rule .get ('match' ) is None :
190193 input_ = FileReference (type = container_type , id = str (container ['_id' ]), name = file_ ['name' ])
191- job = queue_job_legacy (alg_name , input_ )
194+ job = queue_job_legacy (gear_id , input_ )
192195 else :
193196 inputs = { }
194197
195198 for input_name , match_type in rule ['match' ].iteritems ():
196199 match = find_type_in_container (container , match_type )
197200 if match is None :
198- raise Exception ("No type " + match_type + " found for alg rule " + alg_name + " that should have been satisfied" )
201+ raise Exception ("No type " + match_type + " found for alg rule " + gear_tag + " that should have been satisfied" )
199202 inputs [input_name ] = FileReference (type = container_type , id = str (container ['_id' ]), name = match ['name' ])
200203
201- gear = gears .get_gear_by_name (alg_name )
202- job = Job (str (gear ['_id' ]), inputs , tags = ['auto' , alg_name ])
204+ job = Job (str (gear ['_id' ]), inputs , tags = ['auto' , gear_tag ])
203205
204206 potential_jobs .append ({
205207 'job' : job ,
@@ -248,7 +250,7 @@ def create_jobs(db, container_before, container_after, container_type):
248250 job_map = pj ['job' ].map ()
249251 Queue .enqueue_job (job_map , origin )
250252
251- spawned_jobs .append (pj ['rule' ]['alg ' ])
253+ spawned_jobs .append (pj ['rule' ]['gear_id ' ])
252254
253255 return spawned_jobs
254256
0 commit comments