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
37 # The cutoff time to declare a test job is completed and container is orphaned.
39 # is still in the process of destroying the container it used.
43 """Get job id and autoserv process id from container name.
45 @param container: Name of the container.
47 @return: job id and autoserv process id for the given container name.
52 # Container is not created for test, e.g., the base container.
59 def is_container_orphaned(container): argument
60 """Check if a container is orphaned.
62 A container is orphaned if any of these condition is True:
63 1. The autoserv process created the container is no longer running.
66 @param container: A Container object.
68 @return: True if the container is orphaned.
71 logging.debug('Checking if container is orphaned: %s', container.name)
72 job_id, pid = get_info(container.name)
74 logging.debug('Container %s is not created for test.', container.name)
78 logging.debug('Process with PID %s is not alive, container %s is '
79 'orphaned.', pid, container.name)
93 logging.debug('Test job %s is not completed yet, container %s is '
94 'not orphaned.', job_id, container.name)
103 logging.debug('Test job %s was completed, container %s is orphaned.',
104 job_id, container.name)
108 def cleanup(container, options): argument
109 """Cleanup orphaned container.
111 @param container: A Container object to be cleaned up.
118 logging.info('dryrun: Cleanup container %s', container.name)
122 _, pid = get_info(container.name)
128 # Destroy container
129 logging.info('Destroying container %s...', container.name)
130 container.destroy()
133 logging.error('Failed to cleanup container %s. Error: %s',
134 container.name, e)
174 logging.info('Cleaning container bucket %s', bucket.container_path)
177 for container in bucket.get_all().values():
178 if is_container_orphaned(container):
179 if cleanup(container, options):