This is an automated email from the ASF dual-hosted git repository.
bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 6f0b48d Removed outdated scaling framework.
6f0b48d is described below
commit 6f0b48dba17a93fe1b737cb937c58ee48fa6fc76
Author: Benjamin Bannier <[email protected]>
AuthorDate: Sun Mar 3 12:48:23 2019 +0100
Removed outdated scaling framework.
This old code was never updated for recent changes, is not documented,
and currently does not work anymore. Removing it for now. Should we
decide to bring it back in the future we should make sure it is tested
automatically so it does not go out of sync again, and also that it is
documented and discoverable by users.
Review: https://reviews.apache.org/r/70103
---
src/scaling/nested_exec | 4 --
src/scaling/nested_exec.py | 53 -----------------------
src/scaling/scaling_exec | 4 --
src/scaling/scaling_exec.py | 101 -------------------------------------------
src/scaling/scaling_sched | 4 --
src/scaling/scaling_sched.py | 99 ------------------------------------------
6 files changed, 265 deletions(-)
diff --git a/src/scaling/nested_exec b/src/scaling/nested_exec
deleted file mode 100755
index 45ba126..0000000
--- a/src/scaling/nested_exec
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-export PYTHONPATH="$PYTHONPATH:../swig/python"
-cd `dirname $0`
-exec ./nested_exec.py $@
diff --git a/src/scaling/nested_exec.py b/src/scaling/nested_exec.py
deleted file mode 100755
index 28ccc3f..0000000
--- a/src/scaling/nested_exec.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import mesos
-import pickle
-import time
-
-
-class NestedExecutor(mesos.Executor):
- def __init__(self):
- mesos.Executor.__init__(self)
- self.tid = -1
-
- def registered(self, driver, executorInfo, frameworkInfo, slaveInfo):
- self.frameworkId = frameworkInfo.id;
-
- def launchTask(self, driver, task):
- self.tid = task.taskId
- duration = pickle.loads(task.arg)
- print "(%s:%d) Sleeping for %s seconds." % (self.fid, self.tid, duration)
- # TODO(benh): Don't sleep, this blocks the event loop!
- time.sleep(duration)
- status = mesos.TaskStatus(self.tid, mesos.TASK_FINISHED, "")
- driver.sendStatusUpdate(status)
- time.sleep(1)
-
- def killTask(self, driver, tid):
- if (self.tid != tid):
- print "Expecting different task id ... killing anyway!"
- status = mesos.TaskStatus(tid, mesos.TASK_FINISHED, "")
- driver.sendStatusUpdate(status)
-
- def error(self, driver, code, message):
- print "Error: %s" % message
-
-
-if __name__ == "__main__":
- mesos.MesosExecutorDriver(NestedExecutor()).run()
diff --git a/src/scaling/scaling_exec b/src/scaling/scaling_exec
deleted file mode 100755
index 3be8bc8..0000000
--- a/src/scaling/scaling_exec
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-export PYTHONPATH="$PYTHONPATH:../swig/python"
-cd `dirname $0`
-exec ./scaling_exec.py $@
diff --git a/src/scaling/scaling_exec.py b/src/scaling/scaling_exec.py
deleted file mode 100755
index e9f4a86..0000000
--- a/src/scaling/scaling_exec.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import mesos
-import os
-import pickle
-import sys
-
-CPUS = 1
-MEM = 50*1024*1024
-
-class NestedScheduler(mesos.Scheduler):
- def __init__(self, todo, duration, executor):
- mesos.Scheduler.__init__(self)
- self.tid = 0
- self.todo = todo
- self.finished = 0
- self.duration = duration
- self.executor = executor
-
- def getFrameworkName(self, driver):
- return "Nested Framework: %d todo at %d secs" % (self.todo, self.duration)
-
- def getExecutorInfo(self, driver):
- execPath = os.path.join(os.getcwd(), "nested_exec")
- return mesos.ExecutorInfo(execPath, "")
-
- def registered(self, driver, fid):
- print "Nested Scheduler Registered!"
-
- def resourceOffer(self, driver, oid, offers):
- tasks = []
- for offer in offers:
- if self.todo != self.tid:
- self.tid += 1
- pars = {"cpus": "%d" % CPUS, "mem": "%d" % MEM}
- task = mesos.TaskInfo(self.tid,
- offer.slaveId,
- "task %d" % self.tid,
- pars,
- pickle.dumps(self.duration))
- tasks.append(task)
- #msg = mesos.FrameworkMessage(-1, , "")
- #executor.sendFrameworkMessage("")
- driver.launchTasks(oid, tasks)
-
- def statusUpdate(self, driver, status):
- if status.state == mesos.TASK_FINISHED:
- self.finished += 1
- if self.finished == self.todo:
- print "All nested tasks done, stopping scheduler and enclosing executor!"
- driver.stop()
- self.executor.stop()
-
-
-class ScalingExecutor(mesos.Executor):
- def __init__(self):
- mesos.Executor.__init__(self)
- self.tid = -1
- self.nested_driver = -1
-
- def launchTask(self, driver, task):
- self.tid = task.taskId
- master, (todo, duration) = pickle.loads(task.arg)
- scheduler = NestedScheduler(todo, duration, self)
- print "Running here:" + master
- self.nested_driver = mesos.MesosSchedulerDriver(scheduler, master)
- self.nested_driver.start()
-
- def killTask(self, driver, tid):
- if (tid != self.tid):
- print "Expecting different task id ... killing anyway!"
- if self.nested_driver != -1:
- self.nested_driver.stop()
- self.nested_driver.join()
- driver.sendStatusUpdate(mesos.TaskStatus(tid, mesos.TASK_FINISHED, ""))
-
- def shutdown(self, driver):
- self.killTask(self.tid)
-
- def error(self, driver, code, message):
- print "Error: %s" % message
-
-
-if __name__ == "__main__":
- mesos.MesosExecutorDriver(ScalingExecutor()).run()
diff --git a/src/scaling/scaling_sched b/src/scaling/scaling_sched
deleted file mode 100755
index 5c6c247..0000000
--- a/src/scaling/scaling_sched
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-export PYTHONPATH="$PYTHONPATH:../swig/python"
-cd `dirname $0`
-exec ./scaling_sched.py $@
diff --git a/src/scaling/scaling_sched.py b/src/scaling/scaling_sched.py
deleted file mode 100755
index 011e353..0000000
--- a/src/scaling/scaling_sched.py
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env python
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import mesos
-import random
-import sys
-import time
-import os
-import pickle
-
-CPUS = 1
-MEM = 50*1024*1024
-
-config1 = [ (1,20) ]
-
-config2 = [ (1,20), (1,240) ]
-
-config = [ (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120),
- (50, 120) ]
-
-class ScalingScheduler(mesos.Scheduler):
- def __init__(self, master):
- mesos.Scheduler.__init__(self)
- self.tid = 0
- self.master = master
- print self.master
- self.running = {}
-
- def getFrameworkName(self, driver):
- return "Scaling Framework"
-
- def getExecutorInfo(self, driver):
- execPath = os.path.join(os.getcwd(), "scaling_exec")
- return mesos.ExecutorInfo(execPath, "")
-
- def registered(self, driver, fid):
- print "Scaling Scheduler Registered!"
-
- def resourceOffer(self, driver, oid, offers):
- # Make sure the nested schedulers can actually run their tasks.
- # if len(offers) <= len(config) and len(config) != self.tid:
- # print "Need at least one spare agent to do this work ... exiting!"
- # driver.stop()
- # return
-
- # Farm out the schedulers!
- tasks = []
- for offer in offers:
- if len(config) != self.tid:
- (todo, duration) = config[self.tid]
- arg = pickle.dumps((self.master, (todo, duration)))
- pars = {"cpus": "%d" % CPUS, "mem": "%d" % MEM}
- task = mesos.TaskInfo(self.tid, offer.slaveId,
- "task %d" % self.tid, pars, arg)
- tasks.append(task)
- self.running[self.tid] = (todo, duration)
- self.tid += 1
- print "Launching (%d, %d) on agent %s" % (todo, duration,
offer.slaveId)
- driver.launchTasks(oid, tasks)
-
- def statusUpdate(self, driver, status):
- # For now, we are expecting our tasks to be lost ...
- if status.state == mesos.TASK_LOST:
- todo, duration = self.running[status.taskId]
- print "Finished %d todo at %d secs" % (todo, duration)
- del self.running[status.taskId]
- if self.tid == len(config) and len(self.running) == 0:
- driver.stop()
-
-
-if __name__ == "__main__":
- if sys.argv[1] == "local" or sys.argv[1] == "localquiet":
- print "Cannot do scaling experiments with 'local' or 'localquiet'!"
- sys.exit(1)
-
- mesos.MesosSchedulerDriver(ScalingScheduler(sys.argv[1]), sys.argv[1]).run()