Home | History | Annotate | Download | only in scheduler

Lines Matching full:host

5 """RDB Host objects.
7 RDBHost: Basic host object, capable of retrieving fields of a host that
8 correspond to columns of the host table.
10 RDBServerHostWrapper: Server side host adapters that help in making a raw
11 database host object more ameanable to the classes and functions in the rdb
14 RDBClientHostWrapper: Scheduler host proxy that converts host information
15 returned by the rdb into a client host object capable of proxying updates
33 """A python host object representing a django model for the host."""
43 the host tables as class attributes.
59 def get_required_fields_from_host(cls, host):
60 """Returns all required attributes of the host parsed into a dict.
63 create an RDBHost, and mirror the columns of the host table.
65 @param host: A host object containing all required fields as attributes.
70 required_fields_map[field] = getattr(host, field)
73 required_fields_map['id'] = host.id
78 """Returns information about this host object.
80 @return: A dictionary of fields representing the host.
86 """A host wrapper for the base host object.
89 and a few more that make the task of host assignment easier. It handles
91 1. Serialization of the host object and foreign keys
93 3. Checking the leased bit/status of a host before leasing it out.
96 def __init__(self, host):
99 @param host: An instance of the Host model class.
101 host_fields = RDBHost.get_required_fields_from_host(host)
103 self.labels = rdb_utils.LabelIterator(host.labels.all())
104 self.acls = [aclgroup.id for aclgroup in host.aclgroup_set.all()]
105 self.protection = host.protection
106 platform = host.platform()
108 # backwards compatibility with the rest of the host model.
110 self.shard_id = host.shard_id
117 all the required fields of the host are refreshed.
124 # trust the leased bit on a cached host.
127 refreshed_fields = afe_models.Host.objects.filter(
136 """Set the leased bit on the host object, and in the database.
138 @raises RDBException: If the host is already leased.
142 raise rdb_utils.RDBException('Host %s is already leased' %
146 # preferable to calling save() on the host object because we're only
148 afe_models.Host.objects.filter(id=self.id).update(leased=self.leased)
152 """Returns all information needed to scheduler jobs on the host.
155 serialize foreign keys of the original host, which are stored
158 @return: A dictionary of host information.
171 """A client host wrapper for the base host object.
174 to the host.
180 # attributes on a host, so if a client tries accessing an
182 # so makes it easier to add fields to the rdb host without
201 logging.info('Host %s in %s updating %s through rdb on behalf of: %s ',
207 raise rdb_utils.RDBException('Host %s unable to perform update '
235 """Proxy for setting the status of a host via the rdb.
244 """Proxy for updating a field on the host.
253 """Get the platform and labels on this host.
263 """Get the name of the platform of this host.
284 """Get the names of the board of this host.
295 """Get the names of the pools of this host.
297 @return: A list of pool names that the host is assigned to.
310 extra_fields: Extra fields, outside the columns of a host table.
312 @return: A dictionary representing the fields of this host object.
320 """Save any local data a client of this host object might have saved.
323 common django pattern. Most, if not all updates to the host happen
327 this host another model might have set on it before calling its own
330 task.host.status = 'Running'
334 Functions like add_host_to_labels will have to update this host object
341 """Decorator for functions that return a list of Host objects.
350 @param hosts: A list of hosts. Each host is assumed to contain
352 @return: A list of rdb_hosts.RDBServerHostWrappers, one per host, or an
356 return [RDBServerHostWrapper(host) for host in hosts]