Fix snapshot status_info update error 61/167761/2
authorhyokeun <hyokeun.jeon@samsung.com>
Mon, 22 Jan 2018 01:38:47 +0000 (10:38 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Mon, 22 Jan 2018 01:46:39 +0000 (10:46 +0900)
1. Fix snapshot status_info update error
2. Split OBS worker VM request between normal and power.
3. Remove wait for imager VM creation.

Change-Id: I83652de261cb3cf44a6d62a48b2a0adc071e98e7

job_buildmonitor.py
job_control_ondemand_slaves.groovy
job_obs_worker_auto_scailing.py

index 775651c..94b0986 100644 (file)
@@ -1430,7 +1430,7 @@ def update_build_fail_reason_warning(bm_snapshot_name, bm_buildfailreason):
     if existing_info == 0 or existing_info is None:
         info_str = bm_buildfailreason
     else:
-        info_str = "%s %s" % (bm_buildfailreason)
+        info_str = "%s %s" % (info_str, bm_buildfailreason)
     query = "UPDATE build_snapshot SET status_info=%s WHERE snapshot_name=%s LIMIT 1"
     query_data = (info_str, bm_snapshot_name)
     buildmonitor_db.do_query(query, query_data)
index 2cca1d8..698ea57 100644 (file)
@@ -128,7 +128,6 @@ public class WorkerConf_JENKINS_IMAGER extends WorkerConf {
         def String fileContents = new File(this.get_remote_ssh_priv_key()).text
         def String fileContentsKnownHosts = new File(this.get_remote_ssh_known_hosts()).text
         return """#!bin/bash
-service sshd stop
 sed -i "s/[0-9]\\+/0/g" /etc/apt/apt.conf.d/20auto-upgrades
 sed -i "s/[0-9]\\+/0/g" /etc/apt/apt.conf.d/10periodic
 sed -i "s/^\t/\\/\\/\t/g" /etc/apt/apt.conf.d/50unattended-upgrades
@@ -138,8 +137,6 @@ echo "User ${this.remote_user()}" > /home/${this.remote_user()}/.ssh/config
 echo "IdentityFile /home/${this.remote_user()}/.ssh/id_rsa" >> /home/${this.remote_user()}/.ssh/config
 chown -R ${this.remote_user()}:${this.remote_user()} ${this.remote_fs()}
 chmod 0600 /home/${this.remote_user()}/.ssh/id_rsa
-sleep 90
-service sshd start
 """
     }
 }
@@ -356,8 +353,6 @@ def check_healthy_status(worker_conf, vm_list) {
         }
     }
 
-    //TODO: Lets run multi-threaded code
-
 }
 
 
@@ -497,7 +492,7 @@ def worker_ondemand_create_request(worker_conf, Integer num_requested_executors)
         v['tags'].each { n -> 
             if (n['Key'] == 'slot') {
                 used_slot_number = n['Value']
-                println "Removing $used_slot_number"
+                println "Removing unused $used_slot_number from allocated pool."
                 free_slots.remove(used_slot_number)
                 allocated_slots.add(used_slot_number)
             }
index d59f030..8a2f3a1 100644 (file)
@@ -145,7 +145,7 @@ def request_workers(num_executors, worker_type=OBS_NORMAL_WORKER):
         purpose = "OBS_WORKER_POWER"
     if os.getenv("ONDEMAND_SLAVE_CONFIGURATION_ENABLED", "0") == "1":
         if num_executors > 0:
-            trigger_next("SLAVE_BUILDER", {"data":"dummy"}, \
+            trigger_next("SLAVE_BUILDER_%s" % worker_type, {"data":"dummy"}, \
                      extra_params={"ACTION": "REQUEST_WORKER", \
                                    "PURPOSE": purpose, \
                                    "REQUESTED_NUM_EXECUTORS": "%d" % num_executors})
@@ -221,7 +221,9 @@ def main():
 
     if num_need_more > 0:
         if len(worker_status['power_slots']) < int(max_power):
-            request_workers(num_need_more / 4, worker_type=OBS_POWER_WORKER)
+            num_need_more = min(num_need_more / 4, 10)
+            request_workers(num_need_more, worker_type=OBS_POWER_WORKER)
+            request_workers(1, worker_type=OBS_NORMAL_WORKER)
             print "\"TitleDisplay\": \"+P(%d)\"" % num_need_more
         else:
             request_workers(num_need_more / 10, worker_type=OBS_NORMAL_WORKER)