|
|
@@ -24,12 +24,12 @@ module JobsHelper
|
24
|
24
|
#
|
25
|
25
|
# Can return nil, or an instance of Agent.
|
26
|
26
|
def agent_from_job(job)
|
27
|
|
- begin
|
28
|
|
- Agent.find_by_id(YAML.load(job.handler).job_data['arguments'][0])
|
29
|
|
- rescue ArgumentError
|
30
|
|
- # We can get to this point before all of the agents have loaded (usually,
|
31
|
|
- # in development)
|
32
|
|
- nil
|
|
27
|
+ if data = YAML.load(job.handler).try(:job_data)
|
|
28
|
+ Agent.find_by_id(data['arguments'][0])
|
33
|
29
|
end
|
|
30
|
+ rescue ArgumentError
|
|
31
|
+ # We can get to this point before all of the agents have loaded (usually,
|
|
32
|
+ # in development)
|
|
33
|
+ nil
|
34
|
34
|
end
|
35
|
35
|
end
|