Esempio n. 1
0
    def __init__(self):
        self.persistedRDDlineageList = []
        self.current_WorkingOn_FileName = ''
        self.partitions = []
        self.workers = []
        self.tasks = []
        self.chunk = 5

        self.rddLineageList = []

        self._green_stdin = fileobject.FileObject(sys.stdin)
        self._green_stdout = fileobject.FileObject(sys.stdout)

        self.method = 'a'
        self.single_ResultList = []
        self.total_ResultList = []
        self.totalResult = None
        self.filename = None

        self.currentWork = {}
        print colored(
            '======Spark initialized, plz w8 until workers online======',
            'white')

        gevent.spawn(self.controller)
        gevent.spawn(self.run_console)
Esempio n. 2
0
 def open(self, *args, **kwargs):
     self._init_archive()
     try:
         if self.inside_archive:
             f = self._archive.open(self.archive_name, *args, **kwargs)
         else:
             f = open(self.get(), *args, **kwargs)
         f = fileobject.FileObject(f)
     except PermissionError:
         if self.is_dir:
             raise exceptions.CoreError(
                 utils.this_function(),
                 "Tried to open a folder which is not possible")
         raise
     yield f
     f.close()
Esempio n. 3
0
===============================================================================
Librarian REPL
-------------------------------------------------------------------------------
You may use Librarian REPL to interact with RUNNING LIBRARIAN CODE. This is a
standard Python shell with access to objects that are present at runtime. A few
useful objects you can access are:

    `databases`: mapping of databases and respective Database objects
    `servers`: list of currently active gevent servers
    `config`: configuration dictionary

To exit the REPL, type exit() or Ctrl-D (Ctrl-Z followed by Enter on Windows).
===============================================================================
"""

_green_stdin = fileobject.FileObject(sys.stdin)
_green_stdout = fileobject.FileObject(sys.stdout)


def _green_raw_input(prompt):
    _green_stdout.write(prompt)
    _green_stdout.flush()
    return _green_stdin.readline()[:-1]


def repl_factory(local, exit_message):
    def repl_starter():
        code.interact(BANNER, _green_raw_input, local=local)
        print(exit_message)

    return repl_starter
Esempio n. 4
0
 def __init__(self, name):
     self.name = name
     self.fd = os.open(name, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
     self.writer = fileobject.FileObject(self.fd, 'wb', bufsize=0)