login Signup

How do I retrieve jobStep properties?

I have a postProcessor which sets a property on /myJobStep & I see the property appear in the properties tab of the job's step when it completes execution. This step is a child step of another step in the job. The child step is created dynamically by the parent step.

I am not seeing the properties I set in the output of findJobSteps which I execute for the parent stepId. How can I retrieve the property set by the postprocessor for the steps that are created by the parent?

CODE that is used to findJobSteps:

use XML::XPath; use ElectricCommander;

$cmdr = ElectricCommander->new();

my $retrievedId = $cmdr->getProperty("/myJob/createStepsId")->findvalue('//value')->value();

my $xPath = $cmdr->findJobSteps({jobStepId => "$retrievedId"}); print "Return data from ElectricFlow:\n" . $xPath-> findnodes_as_string("/"). "\n";

avatar image By happy 82 asked Nov 29, 2017 at 06:51 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

Hello @happy. Your assignment to $retrievedId is missing part of the path. I corrected this and tested locally with success.

In my testing, I created a job step called "step1" that dynamically creates multiple other job steps, each of which gets a property called "stepProp" assigned to it.

Then I have a "step2", who's code finds the dynamic jobStep names from step1's ID and retrieves the stepProp properties from them. Find the code for step2 here:

use strict; $|=1; use ElectricCommander; use XML::XPath; my $ec = new ElectricCommander();

my $retrievedId = $ec->getProperty("/myJob/jobSteps/step1/jobStepId")->findvalue('//value')->value();

my $xPath = $ec->findJobSteps({jobStepId=> "$retrievedId"}); print "Return data from ElectricFlow:\n" . $xPath->findnodes_as_string("/"). "\n";

my @steps = $xPath->findnodes('//jobStep'); foreach my $step (@steps) { my $stepName = $step->findvalue("stepName"); my $stepProp = $ec->getProperty("/myJob/jobSteps/createStepsId/jobSteps/step1/stepProp")->findvalue("//value"); }

Hope this helps, Chris

avatar image By cdoucet 95 answered Jan 09 at 06:50 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.