<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242291] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242291">242291</a></dd>
<dt>Author</dt> <dd>aakash_jain@apple.com</dd>
<dt>Date</dt> <dd>2019-03-01 15:09:31 -0800 (Fri, 01 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ews-app] Update primary keys for handling multiple Buildbot instances
https://bugs.webkit.org/show_bug.cgi?id=195120

Reviewed by Stephanie Lewis.

Use a new primary key uid for build and step tables. Previous primary keys build_id and step_id
were not enough to handle multiple buildbot instances. This new primary key uid would be generated
by a combination of buildbot_instance_id and current primary key. e.g.: buildbot_instance_id + build_id

* BuildSlaveSupport/ews-app/ews/models/build.py: Added new primary key uid.
* BuildSlaveSupport/ews-app/ews/models/step.py: Ditto.
* BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py: Generate uid and instance_id.
* BuildSlaveSupport/ews-app/ews/views/results.py: Updated to receive hostname in events.
* BuildSlaveSupport/ews-build/events.py: Send hostname along-with events.
* BuildSlaveSupport/ews-build/master.cfg: Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsBuildSlaveSupportewsappewsmodelsbuildpy">trunk/Tools/BuildSlaveSupport/ews-app/ews/models/build.py</a></li>
<li><a href="#trunkToolsBuildSlaveSupportewsappewsmodelsbuildbotinstancepy">trunk/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py</a></li>
<li><a href="#trunkToolsBuildSlaveSupportewsappewsmodelssteppy">trunk/Tools/BuildSlaveSupport/ews-app/ews/models/step.py</a></li>
<li><a href="#trunkToolsBuildSlaveSupportewsappewsviewsresultspy">trunk/Tools/BuildSlaveSupport/ews-app/ews/views/results.py</a></li>
<li><a href="#trunkToolsBuildSlaveSupportewsbuildeventspy">trunk/Tools/BuildSlaveSupport/ews-build/events.py</a></li>
<li><a href="#trunkToolsBuildSlaveSupportewsbuildmastercfg">trunk/Tools/BuildSlaveSupport/ews-build/master.cfg</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsBuildSlaveSupportewsappewsmodelsbuildpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/models/build.py (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-app/ews/models/build.py        2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/models/build.py   2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> from django.db import models
</span><span class="cx"> from ews.config import ERR_UNEXPECTED, SUCCESS
</span><ins>+from ews.models.buildbotinstance import BuildbotInstance
</ins><span class="cx"> from ews.models.patch import Patch
</span><span class="cx"> import ews.common.util as util
</span><span class="cx"> 
</span><span class="lines">@@ -34,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> class Build(models.Model):
</span><span class="cx">     patch = models.ForeignKey(Patch, on_delete=models.CASCADE)
</span><del>-    build_id = models.IntegerField(primary_key=True)
</del><ins>+    uid = models.TextField(primary_key=True)
</ins><span class="cx">     builder_id = models.IntegerField()
</span><span class="cx">     builder_name = models.TextField()
</span><span class="cx">     builder_display_name = models.TextField()
</span><span class="lines">@@ -47,30 +48,31 @@
</span><span class="cx">     modified = models.DateTimeField(auto_now=True)
</span><span class="cx"> 
</span><span class="cx">     def __str__(self):
</span><del>-        return str(self.build_id)
</del><ins>+        return str(self.uid)
</ins><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def save_build(cls, patch_id, build_id, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at=None):
</del><ins>+    def save_build(cls, patch_id, hostname, build_id, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at=None):
</ins><span class="cx">         if not Build.is_valid_result(patch_id, build_id, builder_id, number, result, state_string, started_at, complete_at):
</span><span class="cx">             return ERR_UNEXPECTED
</span><span class="cx"> 
</span><del>-        build = Build.get_existing_build(build_id)
</del><ins>+        uid = BuildbotInstance.get_uid(hostname, build_id)
+        build = Build.get_existing_build(uid)
</ins><span class="cx">         if build:
</span><span class="cx">             # If the build data is already present in database, update it, e.g.: build complete event.
</span><del>-            return Build.update_build(build, patch_id, build_id, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at)
</del><ins>+            return Build.update_build(build, patch_id, uid, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at)
</ins><span class="cx"> 
</span><span class="cx">         # Save the new build data, e.g.: build start event.
</span><del>-        Build(patch_id, build_id, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at).save()
-        _log.info('Saved build {} in database for patch_id: {}'.format(build_id, patch_id))
</del><ins>+        Build(patch_id, uid, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at).save()
+        _log.info('Saved build {} in database for patch_id: {}'.format(uid, patch_id))
</ins><span class="cx">         return SUCCESS
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def update_build(cls, build, patch_id, build_id, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at):
</del><ins>+    def update_build(cls, build, patch_id, uid, builder_id, builder_name, builder_display_name, number, result, state_string, started_at, complete_at):
</ins><span class="cx">         if build.patch_id != patch_id:
</span><span class="cx">             _log.error('patch_id {} does not match with patch_id {}. Ignoring new data.'.format(build.patch_id, patch_id))
</span><span class="cx">             return ERR_UNEXPECTED
</span><del>-        if build.build_id != build_id:
-            _log.error('build_id {} does not match with build_id {}. Ignoring new data.'.format(build.build_id, build_id))
</del><ins>+        if build.uid != uid:
+            _log.error('uid {} does not match with uid {}. Ignoring new data.'.format(build.uid, uid))
</ins><span class="cx">             return ERR_UNEXPECTED
</span><span class="cx">         if build.builder_id != builder_id:
</span><span class="cx">             _log.error('builder_id {} does not match with builder_id {}. Ignoring new data.'.format(build.builder_id, builder_id))
</span><span class="lines">@@ -83,14 +85,14 @@
</span><span class="cx">         build.started_at = started_at
</span><span class="cx">         build.complete_at = complete_at
</span><span class="cx">         build.save(update_fields=['result', 'state_string', 'started_at', 'complete_at', 'modified'])
</span><del>-        _log.info('Updated build {} in database for patch_id: {}'.format(build_id, patch_id))
</del><ins>+        _log.info('Updated build {} in database for patch_id: {}'.format(uid, patch_id))
</ins><span class="cx">         return SUCCESS
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def get_existing_build(cls, build_id):
</del><ins>+    def get_existing_build(cls, uid):
</ins><span class="cx">         try:
</span><del>-            return Build.objects.get(build_id=build_id)
-        except:
</del><ins>+            return Build.objects.get(uid=uid)
+        except Build.DoesNotExist:
</ins><span class="cx">             return None
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span></span></pre></div>
<a id="trunkToolsBuildSlaveSupportewsappewsmodelsbuildbotinstancepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py     2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py        2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -22,9 +22,13 @@
</span><span class="cx"> 
</span><span class="cx"> from __future__ import unicode_literals
</span><span class="cx"> 
</span><ins>+import logging
+
</ins><span class="cx"> from django.db import models
</span><span class="cx"> 
</span><ins>+_log = logging.getLogger(__name__)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class BuildbotInstance(models.Model):
</span><span class="cx">     instance_id = models.AutoField(primary_key=True)
</span><span class="cx">     hostname = models.TextField()
</span><span class="lines">@@ -34,3 +38,18 @@
</span><span class="cx"> 
</span><span class="cx">     def __str__(self):
</span><span class="cx">         return '{}_{}'.format(self.instance_id, self.hostname)
</span><ins>+
+    @classmethod
+    def get_instance_id(cls, hostname):
+        try:
+            return BuildbotInstance.objects.get(hostname=hostname, active=True).instance_id
+        except BuildbotInstance.DoesNotExist:
+            instance = BuildbotInstance(hostname=hostname)
+            instance.save()
+            _log.info('Created new buildbot instance id {} for hostname: {}'.format(instance.instance_id, hostname))
+            return instance.instance_id
+
+    @classmethod
+    def get_uid(cls, hostname, build_or_step_id):
+        instance_id = BuildbotInstance.get_instance_id(hostname)
+        return '{}_{}'.format(instance_id, build_or_step_id)
</ins></span></pre></div>
<a id="trunkToolsBuildSlaveSupportewsappewsmodelssteppy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/models/step.py (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-app/ews/models/step.py 2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/models/step.py    2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> from django.db import models
</span><span class="cx"> from ews.config import ERR_UNEXPECTED, SUCCESS
</span><span class="cx"> from ews.models.build import Build
</span><ins>+from ews.models.buildbotinstance import BuildbotInstance
</ins><span class="cx"> import ews.common.util as util
</span><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="lines">@@ -33,8 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class Step(models.Model):
</span><del>-    step_id = models.IntegerField(primary_key=True)
-    build = models.ForeignKey(Build, on_delete=models.CASCADE)
</del><ins>+    uid = models.TextField(primary_key=True)
+    build_uid = models.ForeignKey(Build, on_delete=models.CASCADE, db_column='build_uid')
</ins><span class="cx">     result = models.IntegerField(null=True, blank=True)
</span><span class="cx">     state_string = models.TextField()
</span><span class="cx">     started_at = models.IntegerField(null=True, blank=True)
</span><span class="lines">@@ -43,44 +44,44 @@
</span><span class="cx">     modified = models.DateTimeField(auto_now=True)
</span><span class="cx"> 
</span><span class="cx">     def __str__(self):
</span><del>-        return str(self.step_id)
</del><ins>+        return str(self.uid)
</ins><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def save_step(cls, step_id, build_id, result, state_string, started_at, complete_at=None):
</del><ins>+    def save_step(cls, hostname, step_id, build_id, result, state_string, started_at, complete_at=None):
</ins><span class="cx">         if not Step.is_valid_result(step_id, build_id, result, state_string, started_at, complete_at):
</span><span class="cx">             return ERR_UNEXPECTED
</span><span class="cx"> 
</span><del>-        step = Step.get_existing_step(step_id)
</del><ins>+        step_uid = BuildbotInstance.get_uid(hostname, step_id)
+        build_uid = BuildbotInstance.get_uid(hostname, build_id)
+
+        step = Step.get_existing_step(step_uid)
</ins><span class="cx">         if step:
</span><span class="cx">             # If the step data is already present in database, update it, e.g.: step complete event.
</span><del>-            return Step.update_step(step, step_id, build_id, result, state_string, started_at, complete_at)
</del><ins>+            return Step.update_step(step, step_uid, build_uid, result, state_string, started_at, complete_at)
</ins><span class="cx"> 
</span><span class="cx">         # Save the new step data, e.g.: step start event.
</span><del>-        Step(step_id, build_id, result, state_string, started_at, complete_at).save()
-        _log.debug('Saved step {} in database for build: {}'.format(step_id, build_id))
</del><ins>+        Step(step_uid, build_uid, result, state_string, started_at, complete_at).save()
+        _log.debug('Saved step {} in database for build: {}'.format(step_uid, build_uid))
</ins><span class="cx">         return SUCCESS
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def update_step(cls, step, step_id, build_id, result, state_string, started_at, complete_at):
-        if step.step_id != step_id:
-            _log.error('step_id {} does not match with step_id {}. Ignoring new data.'.format(step.step_id, step_id))
</del><ins>+    def update_step(cls, step, step_uid, build_uid, result, state_string, started_at, complete_at):
+        if step.uid != step_uid:
+            _log.error('step_uid {} does not match with step_uid {}. Ignoring new data.'.format(step.uid, step_uid))
</ins><span class="cx">             return ERR_UNEXPECTED
</span><del>-        if step.build_id != build_id:
-            _log.error('build_id {} does not match with build_id {}. Ignoring new data.'.format(step.build_id, build_id))
-            return ERR_UNEXPECTED
</del><span class="cx">         step.result = result
</span><span class="cx">         step.state_string = state_string
</span><span class="cx">         step.started_at = started_at
</span><span class="cx">         step.complete_at = complete_at
</span><span class="cx">         step.save(update_fields=['result', 'state_string', 'started_at', 'complete_at', 'modified'])
</span><del>-        _log.info('Updated step {} in database for build: {}'.format(step_id, build_id))
</del><ins>+        _log.info('Updated step {} in database for build: {}'.format(step_uid, build_uid))
</ins><span class="cx">         return SUCCESS
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def get_existing_step(cls, step_id):
</del><ins>+    def get_existing_step(cls, uid):
</ins><span class="cx">         try:
</span><del>-            return Step.objects.get(step_id=step_id)
-        except:
</del><ins>+            return Step.objects.get(uid=uid)
+        except Step.DoesNotExist:
</ins><span class="cx">             return None
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span></span></pre></div>
<a id="trunkToolsBuildSlaveSupportewsappewsviewsresultspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/views/results.py (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-app/ews/views/results.py       2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/views/results.py  2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">         if not patch_id or patch_id < 1:
</span><span class="cx">             return HttpResponse("Invalid patch id: {}.".format(patch_id))
</span><span class="cx"> 
</span><del>-        Build.save_build(patch_id=int(patch_id), build_id=data['build_id'], builder_id=data['builder_id'], builder_name=data['builder_name'],
</del><ins>+        Build.save_build(patch_id=int(patch_id), hostname=data['hostname'], build_id=data['build_id'], builder_id=data['builder_id'], builder_name=data['builder_name'],
</ins><span class="cx">                    builder_display_name=data['builder_display_name'], number=data['number'], result=data['result'],
</span><span class="cx">                    state_string=data['state_string'], started_at=data['started_at'], complete_at=data['complete_at'])
</span><span class="cx">         return HttpResponse("Saved data for patch: {}.\n".format(patch_id))
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">         if not self.is_valid_result(data):
</span><span class="cx">             return HttpResponse("Incomplete data.")
</span><span class="cx"> 
</span><del>-        Step.save_step(step_id=data['step_id'], build_id=data['build_id'], result=data['result'],
</del><ins>+        Step.save_step(hostname=data['hostname'], step_id=data['step_id'], build_id=data['build_id'], result=data['result'],
</ins><span class="cx">                    state_string=data['state_string'], started_at=data['started_at'], complete_at=data['complete_at'])
</span><span class="cx">         return HttpResponse("Saved data for step: {}.\n".format(data['step_id']))
</span><span class="cx"> 
</span><span class="lines">@@ -77,9 +77,9 @@
</span><span class="cx">             _log.error("Invalid data type: {}".format(data['type']))
</span><span class="cx">             return False
</span><span class="cx"> 
</span><del>-        required_keys = {u'ews-build': ['patch_id', 'build_id', 'builder_id', 'builder_name', 'builder_display_name',
</del><ins>+        required_keys = {u'ews-build': ['hostname', 'patch_id', 'build_id', 'builder_id', 'builder_name', 'builder_display_name',
</ins><span class="cx">                                            'number', 'result', 'state_string', 'started_at', 'complete_at'],
</span><del>-                         u'ews-step': ['step_id', 'build_id', 'result', 'state_string', 'started_at', 'complete_at']}
</del><ins>+                         u'ews-step': ['hostname', 'step_id', 'build_id', 'result', 'state_string', 'started_at', 'complete_at']}
</ins><span class="cx"> 
</span><span class="cx">         for key in required_keys.get(data.get('type')):
</span><span class="cx">             if key not in data:
</span></span></pre></div>
<a id="trunkToolsBuildSlaveSupportewsbuildeventspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-build/events.py (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-build/events.py        2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-build/events.py   2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">     EVENT_SERVER_ENDPOINT = 'http://ews.webkit-uat.org/results/'
</span><span class="cx"> 
</span><del>-    def __init__(self, type_prefix='', name='Events'):
</del><ins>+    def __init__(self, master_hostname, type_prefix='', name='Events'):
</ins><span class="cx">         """
</span><span class="cx">         Initialize the Events Plugin. Sends data to event server on specific buildbot events.
</span><span class="cx">         :param type_prefix: [optional] prefix we want to add to the 'type' field on the json we send
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx">         if type_prefix and not type_prefix.endswith("-"):
</span><span class="cx">             type_prefix += "-"
</span><span class="cx">         self.type_prefix = type_prefix
</span><ins>+        self.master_hostname = master_hostname
</ins><span class="cx"> 
</span><span class="cx">     def sendData(self, data):
</span><span class="cx">         agent = Agent(reactor)
</span><span class="lines">@@ -115,6 +116,7 @@
</span><span class="cx">         data = {
</span><span class="cx">             "type": self.type_prefix + "build",
</span><span class="cx">             "status": "started",
</span><ins>+            "hostname": self.master_hostname,
</ins><span class="cx">             "patch_id": self.getPatchID(build),
</span><span class="cx">             "build_id": build.get('buildid'),
</span><span class="cx">             "builder_id": build.get('builderid'),
</span><span class="lines">@@ -142,6 +144,7 @@
</span><span class="cx">         data = {
</span><span class="cx">             "type": self.type_prefix + "build",
</span><span class="cx">             "status": "finished",
</span><ins>+            "hostname": self.master_hostname,
</ins><span class="cx">             "patch_id": self.getPatchID(build),
</span><span class="cx">             "build_id": build.get('buildid'),
</span><span class="cx">             "builder_id": build.get('builderid'),
</span><span class="lines">@@ -161,6 +164,7 @@
</span><span class="cx">         data = {
</span><span class="cx">             "type": self.type_prefix + "step",
</span><span class="cx">             "status": "started",
</span><ins>+            "hostname": self.master_hostname,
</ins><span class="cx">             "step_id": step.get('stepid'),
</span><span class="cx">             "build_id": step.get('buildid'),
</span><span class="cx">             "result": step.get('results'),
</span><span class="lines">@@ -175,6 +179,7 @@
</span><span class="cx">         data = {
</span><span class="cx">             "type": self.type_prefix + "step",
</span><span class="cx">             "status": "finished",
</span><ins>+            "hostname": self.master_hostname,
</ins><span class="cx">             "step_id": step.get('stepid'),
</span><span class="cx">             "build_id": step.get('buildid'),
</span><span class="cx">             "result": step.get('results'),
</span></span></pre></div>
<a id="trunkToolsBuildSlaveSupportewsbuildmastercfg"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/ews-build/master.cfg (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/ews-build/master.cfg       2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/BuildSlaveSupport/ews-build/master.cfg  2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -26,5 +26,5 @@
</span><span class="cx"> 
</span><span class="cx"> loadConfig.loadBuilderConfig(c, use_localhost_worker=is_test_mode_enabled)
</span><span class="cx"> 
</span><del>-event_reporter = Events(type_prefix='ews')
</del><ins>+event_reporter = Events(master_hostname='ews-build.webkit.org', type_prefix='ews')
</ins><span class="cx"> c['services'] = [event_reporter]
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (242290 => 242291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-03-01 22:48:54 UTC (rev 242290)
+++ trunk/Tools/ChangeLog       2019-03-01 23:09:31 UTC (rev 242291)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2019-03-01  Aakash Jain  <aakash_jain@apple.com>
+
+        [ews-app] Update primary keys for handling multiple Buildbot instances
+        https://bugs.webkit.org/show_bug.cgi?id=195120
+
+        Reviewed by Stephanie Lewis.
+
+        Use a new primary key uid for build and step tables. Previous primary keys build_id and step_id
+        were not enough to handle multiple buildbot instances. This new primary key uid would be generated
+        by a combination of buildbot_instance_id and current primary key. e.g.: buildbot_instance_id + build_id
+
+        * BuildSlaveSupport/ews-app/ews/models/build.py: Added new primary key uid.
+        * BuildSlaveSupport/ews-app/ews/models/step.py: Ditto.
+        * BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py: Generate uid and instance_id.
+        * BuildSlaveSupport/ews-app/ews/views/results.py: Updated to receive hostname in events.
+        * BuildSlaveSupport/ews-build/events.py: Send hostname along-with events.
+        * BuildSlaveSupport/ews-build/master.cfg: Ditto.
+
</ins><span class="cx"> 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
</span><span class="cx"> 
</span><span class="cx">         [WinCairo] Enable service worker
</span></span></pre>
</div>
</div>

</body>
</html>