Example #1
0
    def getExecutorInfo(self, framework_id):
        info = mesos_pb2.ExecutorInfo()
        if hasattr(info, 'framework_id'):
            info.framework_id.value = framework_id

        if self.use_self_as_exec:
            info.command.value = os.path.abspath(sys.argv[0])
            info.executor_id.value = sys.argv[0]
        else:
            info.command.value = '%s %s' % (
                sys.executable,
                os.path.abspath(os.path.join(os.path.dirname(__file__), 'executor.py'))
            )
            info.executor_id.value = "default"

        mem = info.resources.add()
        mem.name = 'mem'
        mem.type = 0 #mesos_pb2.Value.SCALAR
        mem.scalar.value = EXECUTOR_MEMORY
        Script = os.path.realpath(sys.argv[0])
        if hasattr(info, 'name'):
            info.name = Script

        info.data = marshal.dumps((Script, os.getcwd(), sys.path, dict(os.environ),
            self.task_per_node, self.out_logger, self.err_logger, self.logLevel, env.environ))
        return info
Example #2
0
    def getExecutorInfo(self, framework_id):
        info = mesos_pb2.ExecutorInfo()
        if hasattr(info, 'framework_id'):
            info.framework_id.value = framework_id

        if self.use_self_as_exec:
            info.command.value = os.path.abspath(sys.argv[0])
            info.executor_id.value = sys.argv[0]
        elif PLATFORM == 'PyPy':
            dir = os.path.dirname(__file__)
            info.command.value = os.path.abspath(
                os.path.join(dir, 'bin/executor-pypy.py'))
            info.executor_id.value = "default"
        else:
            dir = os.path.dirname(__file__)
            info.command.value = os.path.abspath(
                os.path.join(dir,
                             'bin/executor%d%d.py' % sys.version_info[:2]))
            info.executor_id.value = "default"

        mem = info.resources.add()
        mem.name = 'mem'
        mem.type = 0  #mesos_pb2.Value.SCALAR
        mem.scalar.value = EXECUTOR_MEMORY
        info.data = marshal.dumps(
            (os.path.realpath(sys.argv[0]), os.getcwd(), sys.path,
             dict(os.environ), self.task_per_node, self.out_logger,
             self.err_logger, self.logLevel, env.environ))
        return info