示例#1
0
        def getOptions(self):
            """
            Returns the list of options used by the JVM.

            :rtype: list
            """
            return jnius_config.get_options()
示例#2
0
    def run(self, *args: str):

        try:
            jnius_config.add_options(*args)
            log.info("Configured jvm options:%s" % jnius_config.get_options())

            from jnius import autoclass
            DebeziumServer = autoclass('io.debezium.server.Main')
            _dbz = DebeziumServer()
            return _dbz.main()
        finally:
            from jnius import detach
            detach()
示例#3
0
    def __init__(self, name, index, k, num_threads, Xms=None, Xmx=None):
        super().__init__(name)

        if Xms and Xmx:
            # to solve Insufficient memory for the Java Runtime Environment
            jnius_config.add_options("-Xms{}".format(Xms),
                                     "-Xmx{}".format(Xmx),
                                     "-XX:-UseGCOverheadLimit")
            print("Configured options:", jnius_config.get_options())

        self.num_threads = min(num_threads, int(multiprocessing.cpu_count()))

        # initialize a ranker per thread
        self.arguments = []
        for id in tqdm(range(self.num_threads)):
            self.arguments.append({
                "id": id,
                "index": index,
                "k": k,
            })
示例#4
0
"""Handles all imports from jnius to prevent conflicts resulting from attempts
to set JVM options while the VM is already running."""

import jnius_config

if '-Xmx4g' not in jnius_config.get_options():
    if not jnius_config.vm_running:
        jnius_config.add_options('-Xmx4g')
    else:
        warnings.warn("Couldn't set memory limit for Java VM because the VM "
                      "is already running.")

from jnius import autoclass, JavaException, cast

示例#5
0
def get_options():
    return jnius_config.get_options()
示例#6
0
logger = logging.getLogger(__name__)


def _has_xmx(options):
    for option in options:
        if option.startswith('-Xmx'):
            return True
    return False


default_mem_limit = get_config("INDRA_DEFAULT_JAVA_MEM_LIMIT")
if default_mem_limit is None:
    # Set to 8g if not specified in the configuration
    default_mem_limit = '8g'

if not _has_xmx(jnius_config.get_options()):
    if not jnius_config.vm_running:
        jnius_config.add_options('-Xmx%s' % default_mem_limit)
    else:
        logger.warning("Couldn't set memory limit for Java VM because the VM "
                       "is already running.")

path_here = os.path.dirname(os.path.realpath(__file__))
cp = os.path.join(path_here, 'sources/biopax/jars/paxtools.jar')
cp_existing = os.environ.get('CLASSPATH')

if cp_existing is not None:
    os.environ['CLASSPATH'] = cp + ':' + cp_existing
else:
    os.environ['CLASSPATH'] = cp
示例#7
0
文件: java_vm.py 项目: gberriz/indra
"""Handles all imports from jnius to prevent conflicts resulting from attempts
to set JVM options while the VM is already running."""

import os
import warnings
import jnius_config

if "-Xmx4g" not in jnius_config.get_options():
    if not jnius_config.vm_running:
        jnius_config.add_options("-Xmx4g")
    else:
        warnings.warn("Couldn't set memory limit for Java VM because the VM " "is already running.")

path_here = os.path.dirname(os.path.realpath(__file__))
cp = path_here + "/biopax/jars/paxtools.jar"
os.environ["CLASSPATH"] = cp

from jnius import autoclass, JavaException, cast
示例#8
0
logger = logging.getLogger(__name__)


def _has_xmx(options):
    for option in options:
        if option.startswith('-Xmx'):
            return True
    return False


default_mem_limit = get_config("INDRA_DEFAULT_JAVA_MEM_LIMIT")
if default_mem_limit is None:
    # Set to 8g if not specified in the configuration
    default_mem_limit = '8g'

if not _has_xmx(jnius_config.get_options()):
    if not jnius_config.vm_running:
        jnius_config.add_options('-Xmx%s' % default_mem_limit)
    else:
        logger.warning("Couldn't set memory limit for Java VM because the VM "
                       "is already running.")

path_here = os.path.dirname(os.path.realpath(__file__))
cp = os.path.join(path_here, 'sources/biopax/jars/paxtools.jar')
cp_existing = os.environ.get('CLASSPATH')

if cp_existing is not None:
    os.environ['CLASSPATH'] = cp + ':' + cp_existing
else:
    os.environ['CLASSPATH'] = cp