How to test unit template jobs?
Sylvain Pineau
sylvain.pineau at canonical.com
Mon Jan 4 10:39:37 UTC 2016
On 04/01/2016 10:45, Pierre Equoy wrote:
>
>
> On Mon, Jan 4, 2016 at 4:43 PM, Sylvain Pineau
> <sylvain.pineau at canonical.com <mailto:sylvain.pineau at canonical.com>>
> wrote:
>
> Hello,
>
> To test template jobs using the "plainbox run" command you have to
> select the resource job that generates the new jobs.
>
> for example: plainbox run -i .*block_device -i "^.*info/hdparm.*$"
>
>
> Thanks for this, it should help a lot!
>
> Generally speaking, how to know what resource job generates what
> template job(s)?
Juts look at the job definition, the resource job is mentioned in the
field |template-resource
More info here:
|http://plainbox.readthedocs.org/en/latest/manpages/plainbox-template-units.html?highlight=template#template-specific-fields
>
>
> Sylvain
>
>
> On 29/12/2015 07:22, Pierre Equoy wrote:
>> Hey Tai,
>>
>> On Mon, Dec 28, 2015 at 5:45 PM, Taihsiang Ho
>> <taihsiang.ho at canonical.com <mailto:taihsiang.ho at canonical.com>>
>> wrote:
>>
>> Did you apply "sudo" when you test the job?
>> If yes, sudo may use a different env so it could not find out
>> the command.
>>
>>
>> No, I'm not using sudo to run plainbox.
>>
>> To provide a bit more info, here is the output I get when I run
>>
>> plainbox run -i "^.*info/hdparm.*$"
>>
>> with the current local job:
>>
>> ===============================[ Analyzing Jobs
>> ]===============================
>> =============================[ Session Statistics
>> ]=============================
>> This session is about 0.00% complete
>> Estimated duration is 2.64 for automated jobs.
>> Estimated duration cannot be determined for manual jobs.
>> Size of the desired job list: 1
>> Size of the effective execution plan: 3
>> ===========================[ Running Selected Jobs
>> ]============================
>> --------------[ Running job 1 / 3. Estimated time left: 0:00:03
>> ]---------------
>> -----------[ Collect information about installed software
>> packages ]------------
>> ID: 2013.com.canonical.certification::package
>> Category: 2013.com.canonical.plainbox::uncategorised
>> (Command output hidden)
>> Outcome: job passed
>> --------------[ Running job 2 / 3. Estimated time left: 0:00:01
>> ]---------------
>> -------------[ Collect information about hardware devices (udev)
>> ]--------------
>> ID: 2013.com.canonical.certification::device
>> Category: 2013.com.canonical.plainbox::uncategorised
>> (Command output hidden)
>> Outcome: job passed
>> --------------[ Running job 3 / 3. Estimated time left: 0:00:01
>> ]---------------
>> ------------------------[ SATA/IDE device information.
>> ]------------------------
>> ID: 2013.com.canonical.certification::info/hdparm
>> Category: 2013.com.canonical.plainbox::uncategorised
>> (Command output hidden)
>> Outcome: job passed
>> --------------[ Running job 1 / 3. Estimated time left: 0:00:02
>> ]---------------
>> --------------------------------[ block_device
>> ]--------------------------------
>> ID: 2013.com.canonical.certification::block_device
>> Category: 2013.com.canonical.plainbox::uncategorised
>> (Command output hidden)
>> Outcome: job passed
>> --------------[ Running job 2 / 3. Estimated time left: 0:00:02
>> ]---------------
>> ----------------------------[ info/hdparm_sda.txt
>> ]-----------------------------
>> ID: 2013.com.canonical.certification::info/hdparm_sda.txt
>> Category: 2013.com.canonical.plainbox::info
>> (Command output hidden)
>> Outcome: job passed
>> --------------[ Running job 3 / 3. Estimated time left: 0:00:01
>> ]---------------
>> ----------------------------[ info/hdparm_sdb.txt
>> ]-----------------------------
>> ID: 2013.com.canonical.certification::info/hdparm_sdb.txt
>> Category: 2013.com.canonical.plainbox::info
>> (Command output hidden)
>> Outcome: job passed
>> ==================================[ Results
>> ]===================================
>> ☑ : Collect information about installed software packages
>> ☑ : Collect information about hardware devices (udev)
>> ☑ : SATA/IDE device information.
>> ☑ : block_device
>> ☑ : info/hdparm_sda.txt
>> ☑ : info/hdparm_sdb.txt
>>
>>
>> And here is the output I get when I try to run the same command
>> with the new template unit I created to replace the existing
>> info/hdparm local job:
>>
>> % plainbox run -i "^.*info/hdparm.*$"
>> ===============================[ Analyzing Jobs
>> ]===============================
>> =============================[ Session Statistics
>> ]=============================
>> This session is about 0.00% complete
>> Estimated duration cannot be determined for automated jobs.
>> Estimated duration cannot be determined for manual jobs.
>> Size of the desired job list: 0
>> Size of the effective execution plan: 0
>> ===========================[ Running Selected Jobs
>> ]============================
>> ==================================[ Results
>> ]===================================
>>
>>
>>
>>
>> On Mon, Dec 28, 2015 at 10:59 AM, Pierre Equoy
>> <pierre.equoy at canonical.com
>> <mailto:pierre.equoy at canonical.com>> wrote:
>>
>> Hi,
>>
>> I'm trying to migrate local jobs (e.g. from the checkbox
>> provider [1]) to unit template jobs [2].
>>
>> For instance, I replaced the */hdparm/* local job [3] with:
>>
>> unit: template
>> template-unit: job
>> template-resource: device
>> template-filter: device.category == 'DISK'
>> plugin: attachment
>> category_id: 2013.com.canonical.plainbox::info
>> id: info/hdparm_{name}.txt
>> estimated_duration: 1.0
>> requires:
>> package.name <http://package.name> == 'hdparm'
>> device.path == '{path}'
>> block_device.{name}_state != 'removable'
>> user: root
>> command: hdparm -I /dev/{name}
>>
>> My problem is I cannot find this job afterwards! When I
>> try to run plainbox to run this job, it tells me there
>> are no job with the given pattern:
>>
>> plainbox run -i "^.*info/hdparm.*$"
>>
>> (however, this command runs fine with current local job
>> version of hdparm)
>>
>> What am I doing wrong? How to test unit template jobs?
>>
>> Thanks!
>>
>> [1] https://launchpad.net/plainbox-provider-checkbox/
>> [2]
>> http://plainbox.readthedocs.org/en/latest/manpages/plainbox-template-units.html#migrating-from-local-jobs
>> [3]
>> http://bazaar.launchpad.net/~checkbox-dev/checkbox/trunk/view/head:/providers/plainbox-provider-checkbox/jobs/info.txt.in#L212
>> <http://bazaar.launchpad.net/%7Echeckbox-dev/checkbox/trunk/view/head:/providers/plainbox-provider-checkbox/jobs/info.txt.in#L212>
>>
>> --
>> Pierre Equoy
>> QA & Certification Engineer | Canonical
>> www.canonical.com <http://www.canonical.com> |
>> www.ubuntu.com <http://www.ubuntu.com>
>>
>> --
>> Checkbox-devel mailing list
>> Checkbox-devel at lists.ubuntu.com
>> <mailto:Checkbox-devel at lists.ubuntu.com>
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/checkbox-devel
>>
>>
>>
>>
>>
>> --
>> Pierre Equoy
>> QA & Certification Engineer | Canonical
>> www.canonical.com <http://www.canonical.com> | www.ubuntu.com
>> <http://www.ubuntu.com>
>>
>>
>
>
> --
> Checkbox-devel mailing list
> Checkbox-devel at lists.ubuntu.com
> <mailto:Checkbox-devel at lists.ubuntu.com>
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/checkbox-devel
>
>
>
>
> --
> Pierre Equoy
> QA & Certification Engineer | Canonical
> www.canonical.com <http://www.canonical.com> | www.ubuntu.com
> <http://www.ubuntu.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/checkbox-devel/attachments/20160104/ae987e30/attachment-0001.html>
More information about the Checkbox-devel
mailing list