162
162
prog.evaluate_or_raise(session_state.resource_map)
163
163
except ExpressionCannotEvaluateError as exc:
164
# Lookup the related job (the job that provides the
165
# resources needed by the expression that cannot be
167
related_job = session_state.job_state_map[
168
exc.expression.resource_id].job
169
# Add A PENDING_RESOURCE inhibitor as we are unable to
170
# determine if the resource requirement is met or not. This
171
# can happen if the resource job did not ran for any reason
172
# (it can either be prevented from running by normal means
173
# or simply be on the run_list but just was not executed
175
inhibitor = JobReadinessInhibitor(
176
cause=InhibitionCause.PENDING_RESOURCE,
177
related_job=related_job,
178
related_expression=exc.expression)
179
inhibitors.append(inhibitor)
164
for resource_id in exc.expression.resource_id_list:
165
if session_state.job_state_map[resource_id].result.outcome == 'pass':
167
# Lookup the related job (the job that provides the
168
# resources needed by the expression that cannot be
170
related_job = session_state.job_state_map[resource_id].job
171
# Add A PENDING_RESOURCE inhibitor as we are unable to
172
# determine if the resource requirement is met or not. This
173
# can happen if the resource job did not ran for any reason
174
# (it can either be prevented from running by normal means
175
# or simply be on the run_list but just was not executed
177
inhibitor = JobReadinessInhibitor(
178
cause=InhibitionCause.PENDING_RESOURCE,
179
related_job=related_job,
180
related_expression=exc.expression)
181
inhibitors.append(inhibitor)
180
182
except ExpressionFailedError as exc:
181
# Lookup the related job (the job that provides the
182
# resources needed by the expression that failed)
183
related_job = session_state.job_state_map[
184
exc.expression.resource_id].job
185
# Add a FAILED_RESOURCE inhibitor as we have all the data
186
# to run the requirement program but it simply returns a
187
# non-True value. This typically indicates a missing
188
# software package or necessary hardware.
189
inhibitor = JobReadinessInhibitor(
190
cause=InhibitionCause.FAILED_RESOURCE,
191
related_job=related_job,
192
related_expression=exc.expression)
193
inhibitors.append(inhibitor)
183
# When expressions fail then all the associated resources are
184
# marked as failed since we don't want to get into the analysis
185
# of logic expressions to know any "better".
186
for resource_id in exc.expression.resource_id_list:
187
# Lookup the related job (the job that provides the
188
# resources needed by the expression that failed)
189
related_job = session_state.job_state_map[resource_id].job
190
# Add a FAILED_RESOURCE inhibitor as we have all the data
191
# to run the requirement program but it simply returns a
192
# non-True value. This typically indicates a missing
193
# software package or necessary hardware.
194
inhibitor = JobReadinessInhibitor(
195
cause=InhibitionCause.FAILED_RESOURCE,
196
related_job=related_job,
197
related_expression=exc.expression)
198
inhibitors.append(inhibitor)
194
199
# Check if all job dependencies ran successfully
195
200
for dep_id in sorted(job.get_direct_dependencies()):
196
201
dep_job_state = session_state.job_state_map[dep_id]