OLD | NEW |
1 #!/usr/bin/python -u | 1 #!/usr/bin/python -u |
2 | 2 |
3 """ | 3 """ |
4 Autotest scheduler | 4 Autotest scheduler |
5 """ | 5 """ |
6 | 6 |
7 | 7 |
8 import common | 8 import common |
9 import datetime, errno, optparse, os, pwd, Queue, re, shutil, signal | 9 import datetime, errno, optparse, os, pwd, Queue, re, shutil, signal |
10 import smtplib, socket, stat, subprocess, sys, tempfile, time, traceback | 10 import smtplib, socket, stat, subprocess, sys, tempfile, time, traceback, urllib |
11 import itertools, logging, weakref, gc | 11 import itertools, logging, weakref, gc |
12 | 12 |
13 import MySQLdb | 13 import MySQLdb |
14 | 14 |
15 from autotest_lib.scheduler import scheduler_logging_config | 15 from autotest_lib.scheduler import scheduler_logging_config |
16 from autotest_lib.frontend import setup_django_environment | 16 from autotest_lib.frontend import setup_django_environment |
17 | 17 |
18 import django.db | 18 import django.db |
19 | 19 |
20 from autotest_lib.client.common_lib import global_config, logging_manager | 20 from autotest_lib.client.common_lib import global_config, logging_manager |
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 | 1816 |
1817 | 1817 |
1818 def _write_keyvals_before_job(self, keyval_dict): | 1818 def _write_keyvals_before_job(self, keyval_dict): |
1819 self._write_keyvals_before_job_helper(keyval_dict, self._keyval_path()) | 1819 self._write_keyvals_before_job_helper(keyval_dict, self._keyval_path()) |
1820 | 1820 |
1821 | 1821 |
1822 def _write_host_keyvals(self, host): | 1822 def _write_host_keyvals(self, host): |
1823 keyval_path = os.path.join(self._working_directory(), 'host_keyvals', | 1823 keyval_path = os.path.join(self._working_directory(), 'host_keyvals', |
1824 host.hostname) | 1824 host.hostname) |
1825 platform, all_labels = host.platform_and_labels() | 1825 platform, all_labels = host.platform_and_labels() |
| 1826 all_labels = [ urllib.quote(label) for label in all_labels ] |
1826 keyval_dict = dict(platform=platform, labels=','.join(all_labels)) | 1827 keyval_dict = dict(platform=platform, labels=','.join(all_labels)) |
1827 self._write_keyvals_before_job_helper(keyval_dict, keyval_path) | 1828 self._write_keyvals_before_job_helper(keyval_dict, keyval_path) |
1828 | 1829 |
1829 | 1830 |
1830 class SpecialAgentTask(AgentTask, TaskWithJobKeyvals): | 1831 class SpecialAgentTask(AgentTask, TaskWithJobKeyvals): |
1831 """ | 1832 """ |
1832 Subclass for AgentTasks that correspond to a SpecialTask entry in the DB. | 1833 Subclass for AgentTasks that correspond to a SpecialTask entry in the DB. |
1833 """ | 1834 """ |
1834 | 1835 |
1835 TASK_TYPE = None | 1836 TASK_TYPE = None |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 paired_process = self._paired_with_monitor().get_process() | 2592 paired_process = self._paired_with_monitor().get_process() |
2592 _drone_manager.write_lines_to_file( | 2593 _drone_manager.write_lines_to_file( |
2593 failed_file, ['Archiving failed with exit code %s' | 2594 failed_file, ['Archiving failed with exit code %s' |
2594 % self.monitor.exit_code()], | 2595 % self.monitor.exit_code()], |
2595 paired_with_process=paired_process) | 2596 paired_with_process=paired_process) |
2596 self._set_all_statuses(self._final_status()) | 2597 self._set_all_statuses(self._final_status()) |
2597 | 2598 |
2598 | 2599 |
2599 if __name__ == '__main__': | 2600 if __name__ == '__main__': |
2600 main() | 2601 main() |
OLD | NEW |