• Home
  • Raw
  • Download

Lines Matching full:container

9 container used to run the test will be orphaned. This adds overhead to the
12 This module also checks if the test job associated with a container has
14 container. To avoid racing condition, this only applies to job finished at least
34 # The cutoff time to declare a test job is completed and container is orphaned.
36 # is still in the process of destroying the container it used.
39 def is_container_orphaned(container): argument
40 """Check if a container is orphaned.
42 A container is orphaned if any of these condition is True:
43 1. The autoserv process created the container is no longer running.
46 @param container: A Container object.
48 @return: True if the container is orphaned.
51 logging.debug('Checking if container is orphaned: %s', container.name)
52 if container.id is None:
53 logging.debug('Container %s is not created for test.', container.name)
56 job_id = container.id.job_id
57 pid = container.id.pid
60 logging.debug('Process with PID %s is not alive, container %s is '
61 'orphaned.', pid, container.name)
75 logging.debug('Test job %s is not completed yet, container %s is '
76 'not orphaned.', job_id, container.name)
85 logging.debug('Test job %s was completed, container %s is orphaned.',
86 job_id, container.name)
90 def cleanup(container, options): argument
91 """Cleanup orphaned container.
93 @param container: A Container object to be cleaned up.
100 logging.info('dryrun: Cleanup container %s', container.name)
105 # container may be assumed to have a valid ID.
106 pid = container.id.pid
112 # Destroy container
113 logging.info('Destroying container %s...', container.name)
114 container.destroy()
117 logging.error('Failed to cleanup container %s. Error: %s',
118 container.name, e)
158 logging.info('Cleaning container bucket %s', bucket.container_path)
161 for container in bucket.get_all().values():
162 if is_container_orphaned(container):
163 if cleanup(container, options):