class ParticipantHandler(object): """ Participant class as defined by the SkyNET API """ def __init__(self): self.obs = None self.oscrc = None def handle_wi_control(self, ctrl): """ job control thread """ pass def handle_lifecycle_control(self, ctrl): """ participant control thread """ if ctrl.message == "start": if ctrl.config.has_option("obs", "oscrc"): self.oscrc = ctrl.config.get("obs", "oscrc") def setup_obs(self, namespace): """ setup the Buildservice instance using the namespace as an alias to the apiurl """ self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace) def handle_wi(self, wid): """ """ self.setup_obs(wid.fields.ev.namespace) user = Verify.assertMandatoryParameter(wid, "user") field = Verify.assertMandatoryParameter(wid, "field") user_realname, user_email = self.obs.getUserData(user, "realname", "email") wid.set_field(field + ".realname", user_realname) wid.set_field(field + ".email", user_email)