~ubuntu-branches/ubuntu/quantal/checkbox/quantal

« back to all changes in this revision

Viewing changes to checkbox/job.py

  • Committer: Package Import Robot
  • Author(s): Javier Collado, Brendan Donegan, Javier Collado, Marc Tardif, Daniel Manrique, Jeff Lane
  • Date: 2012-06-26 16:07:04 UTC
  • mfrom: (15.1.1 lucid-proposed)
  • Revision ID: package-import@ubuntu.com-20120626160704-xukgwy5skzi4hwt4
Tags: 0.14.1
* New upstream release (LP: #1018571)

[Brendan Donegan]
* Fixed up a few things with the gpu_lockup tests. Removed depends,
  renamed to gpu_lockup_suspend to reflect behaviour and removed the
  requirement on Firefox
* Changed suspend_advanced and suspend_advanced_auto to use less
  strict definition of fwts s3 test.

[Javier Collado]
* Make sure that jobs are topologically ordered (LP: #990075)
* Keep job ordering as close to whitelist as possible (LP: #1017951)

[Marc Tardif]
* New version 0.14.1 for Quantal Quetzal development.
* jobs/suspend.txt.in: Fixed trailing newline on otherwise empty line.
* scripts/run_templates: Fixed calls to Popen to use universal_newlines
  to return strings instead of bytes (LP: #1018354)

[Daniel Manrique]
* Fixed duplicate suspend/bluetooth_obex_after_suspend job name.
* scripts/dpkg_resource: Changed encoding from ascii to utf-8 to handle
  non-ascii locales (LP: #1018353)

[Jeff Lane]
* Migrated audio/external-HDMI-playback into checkbox. Modified the
  command to match our other audio tests that save and reset mixer
  levels.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
class JobStore(MessageStore):
105
105
    """A job store which stores its jobs in a file system hierarchy."""
106
106
 
107
 
    def add(self, job):
108
 
        # TODO: Order alphabetically within suite or non-suite
109
 
 
110
 
        # Remove the same job if it already exists without a suite
111
 
        if "suite" in job:
112
 
            for filename in self._find_matching_messages(name=job["name"], suite=None):
113
 
                os.unlink(filename)
114
 
 
115
 
        # Return if the same job is already in the store
116
 
        if list(self._find_matching_messages(name=job["name"])):
117
 
            return
118
 
 
119
 
        message_id = super(JobStore, self).add(job)
120
 
 
121
 
        # TODO: Apply dependencies
122
 
        if "depends" in job:
123
 
            for depends in job["depends"]:
124
 
                for filename in self._find_matching_messages():
125
 
                    message = self._read_message(filename, cache=True)
126
 
                    if job["name"] in message.get("depends", []):
127
 
                        new_filename = self._get_next_message_filename()
128
 
                        os.rename(filename, new_filename)
129
 
 
130
 
        return message_id
131
 
 
132
 
    # TODO: Optimize by only searching backwards until a given condition
133
 
    def _find_matching_messages(self, **kwargs):
134
 
        for filename in self._walk_messages():
135
 
            message = self._read_message(filename,cache=True)
136
 
            for key, value in kwargs.items():
137
 
                if message.get(key) != value:
138
 
                    break
139
 
            else:
140
 
                yield filename
 
107
    pass