Пример #1
0
    def initialize_child(self):

        # we don't really have an output queue, as we pass control over the
        # pilot jobs to the resource management system (RM).

        self._pilots = dict()  # dict for all known pilots
        self._pilots_lock = threading.RLock()  # lock on maipulating the above
        self._checking = list()  # pilots to check state on
        self._check_lock = threading.RLock()  # lock on maipulating the above
        self._saga_fs_cache = dict()  # cache of saga directories
        self._saga_js_cache = dict()  # cache of saga job services
        self._sandboxes = dict()  # cache of resource sandbox URLs
        self._cache_lock = threading.RLock()  # lock for cache

        self._mod_dir = os.path.dirname(os.path.abspath(__file__))
        self._root_dir = "%s/../../" % self._mod_dir
        self._conf_dir = "%s/configs/" % self._root_dir

        self.register_input(rps.PMGR_LAUNCHING_PENDING,
                            rpc.PMGR_LAUNCHING_QUEUE, self.work)

        # FIXME: make interval configurable
        self.register_timed_cb(self._pilot_watcher_cb, timer=10.0)

        # we listen for pilot cancel and input staging commands
        self.register_subscriber(rpc.CONTROL_PUBSUB, self._pmgr_control_cb)

        self._log.info(ru.get_version([self._mod_dir, self._root_dir]))
        self._rp_version, _, _, _, self._rp_sdist_name, self._rp_sdist_path = \
                ru.get_version([self._mod_dir, self._root_dir])
Пример #2
0
    def initialize_child(self):

        # we don't really have an output queue, as we pass control over the
        # pilot jobs to the resource management system (RM).

        self._pilots        = dict()             # dict for all known pilots
        self._pilots_lock   = threading.RLock()  # lock on maipulating the above
        self._checking      = list()             # pilots to check state on
        self._check_lock    = threading.RLock()  # lock on maipulating the above
        self._saga_fs_cache = dict()             # cache of saga directories
        self._saga_js_cache = dict()             # cache of saga job services
        self._sandboxes     = dict()             # cache of resource sandbox URLs
        self._cache_lock    = threading.RLock()  # lock for cache

        self._mod_dir       = os.path.dirname(os.path.abspath(__file__))
        self._root_dir      = "%s/../../"   % self._mod_dir  
        self._conf_dir      = "%s/configs/" % self._root_dir 

        self.register_input(rps.PMGR_LAUNCHING_PENDING, 
                            rpc.PMGR_LAUNCHING_QUEUE, self.work)

        # FIXME: make interval configurable
        self.register_timed_cb(self._pilot_watcher_cb, timer=10.0)

        # we listen for pilot cancel and input staging commands
        self.register_subscriber(rpc.CONTROL_PUBSUB, self._pmgr_control_cb)

        self._log.info(ru.get_version([self._mod_dir, self._root_dir]))
        self._rp_version, _, _, _, self._rp_sdist_name, self._rp_sdist_path = \
                ru.get_version([self._mod_dir, self._root_dir])
Пример #3
0
from .exceptions import AlreadyExists
from .exceptions import DoesNotExist
from .exceptions import IncorrectState
from .exceptions import PermissionDenied
from .exceptions import AuthorizationFailed
from .exceptions import AuthenticationFailed
from .exceptions import Timeout
from .exceptions import NoSuccess

from . import job
from . import filesystem
from . import replica
from . import advert
from . import resource
# import radical.saga.messages

# ------------------------------------------------------------------------------
#
pwd = os.path.dirname(__file__)
version_short, version_detail, version_base, version_branch, \
               sdist_name, sdist_path = ru.get_version ([pwd])
version = version_short

# FIXME: the logger init will require a 'classical' ini based config, which is
# different from the json based config we use now.   May need updating once the
# radical configuration system has changed to json
_logger = ru.Logger('radical.saga')
_logger.info('radical.saga         version: %s' % version_detail)

# ------------------------------------------------------------------------------
Пример #4
0
#!/usr/bin/env python

# ------------------------------------------------------------------------------
#
# This example demonstrates the use of the Python code tracing facility.
#
# ------------------------------------------------------------------------------

import radical.utils as ru

ru.tracer.trace('radical')
print(ru.get_version())
ru.tracer.untrace()


Пример #5
0
from saga.exceptions import BadParameter
from saga.exceptions import AlreadyExists
from saga.exceptions import DoesNotExist
from saga.exceptions import IncorrectState
from saga.exceptions import PermissionDenied
from saga.exceptions import AuthorizationFailed
from saga.exceptions import AuthenticationFailed
from saga.exceptions import Timeout
from saga.exceptions import NoSuccess

import saga.job
import saga.filesystem
import saga.replica
import saga.advert
import saga.resource

# ------------------------------------------------------------------------------

pwd = os.path.dirname(__file__)
root = "%s/.." % pwd
version, version_detail, version_branch, sdist_name, sdist_path = ru.get_version(
    [root, pwd])

# FIXME: the logger init will require a 'classical' ini based config, which is
# different from the json based config we use now.   May need updating once the
# radical configuration system has changed to json
_logger = rul.logger.getLogger('saga')
_logger.info('saga-python          version: %s' % version_detail)

# ------------------------------------------------------------------------------
Пример #6
0
# ------------------------------------------------------------------------------
#
import os as _os
import radical.utils as _ru

_root = _os.path.dirname(__file__)

version_short, version_detail, version_base, version_branch, \
        sdist_name, sdist_path = _ru.get_version(_root)
version = version_short

# ------------------------------------------------------------------------------
Пример #7
0
from   saga.exceptions     import PermissionDenied
from   saga.exceptions     import AuthorizationFailed
from   saga.exceptions     import AuthenticationFailed
from   saga.exceptions     import Timeout
from   saga.exceptions     import NoSuccess

import saga.job
import saga.filesystem
import saga.replica
import saga.advert
import saga.resource


# ------------------------------------------------------------------------------


pwd     = os.path.dirname (__file__)
root    = "%s/.." % pwd
short_version, long_version, branch = ru.get_version ([root, pwd])
version = long_version

# FIXME: the logger init will require a 'classical' ini based config, which is
# different from the json based config we use now.   May need updating once the
# radical configuration system has changed to json
_logger = rul.logger.getLogger  ('saga')
_logger.info ('saga-python     version: %s' % version)


# ------------------------------------------------------------------------------

Пример #8
0
from   saga.exceptions     import DoesNotExist
from   saga.exceptions     import IncorrectState
from   saga.exceptions     import PermissionDenied
from   saga.exceptions     import AuthorizationFailed
from   saga.exceptions     import AuthenticationFailed
from   saga.exceptions     import Timeout
from   saga.exceptions     import NoSuccess

import saga.job
import saga.filesystem
import saga.replica
import saga.advert
import saga.resource


# ------------------------------------------------------------------------------

pwd     = os.path.dirname (__file__)
root    = "%s/.." % pwd
version, version_detail, version_branch, sdist_name, sdist_path = ru.get_version ([root, pwd])

# FIXME: the logger init will require a 'classical' ini based config, which is
# different from the json based config we use now.   May need updating once the
# radical configuration system has changed to json
_logger = ru.get_logger('radical.saga')
_logger.info ('radical.saga         version: %s' % version_detail)


# ------------------------------------------------------------------------------

Пример #9
0
# ------------------------------------------------------------------------------
#
from .replica import Replica
from .exchange import Exchange
from .algorithms import *

# ------------------------------------------------------------------------------
#
import os
import radical.utils as ru

pwd = os.path.dirname(__file__)
root = "%s" % pwd
version_short, version_detail, version_base, \
        version_branch, sdist_name, sdist_path = ru.get_version(paths=[root])
version = version_short

logger = ru.Logger('radical.repex')
logger.info('radical.repex        version: %s' % version_detail)

# ------------------------------------------------------------------------------
Пример #10
0
# ------------------------------------------------------------------------------

from synapsify import synapsify
from synapsify import NOTHING
from synapsify import PROFILE
from synapsify import EMULATE

from synapse   import profile
from synapse   import emulate
from synapse   import execute



# ------------------------------------------------------------------------------
#

import os
import radical.utils as ru

_mod_root = os.path.dirname (__file__)

version_short, version_detail, version_base, \
               version_branch, sdist_name,   \
               sdist_path = ru.get_version(_mod_root)
version = version_short
_logger = ru.get_logger('radical.synapse')


# ------------------------------------------------------------------------------

Пример #11
0
# ------------------------------------------------------------------------------
# we *first* import radical.utils, so that the monkeypatching of the logger has
# a chance to kick in before the logging module is pulled by any other 3rd party
# module, and also to monkeypatch `os.fork()` for the `atfork` functionality.
# we also get the version string at this point.
#
import os
import radical.utils as _ru

_root = "%s/.." % os.path.dirname(__file__)

version_short, version_detail, version_base, version_branch, \
        sdist_name, sdist_path = _ru.get_version(_root)
version = version_short


# ------------------------------------------------------------------------------
#
from .db_utils     import *
from .prof_utils   import *
from .misc         import *
from .queue        import *
from .pubsub       import *
from .session      import *
from .component    import *
from .slot_utils   import *


# ------------------------------------------------------------------------------
Пример #12
0
import time
import traceback
import threading
import tempfile

import saga
import radical.utils as ru

from ..states import *
from ..utils import logger
from ..context import Context
from ..logentry import Logentry

pwd = os.path.dirname(__file__)
root = "%s/../" % pwd
_, _, _, rp_sdist_name, rp_sdist_path = ru.get_version([root, pwd])

IDLE_TIMER = 1  # seconds to sleep if notthing to do
JOB_CHECK_INTERVAL = 60  # seconds between runs of the job state check loop
JOB_CHECK_MAX_MISSES = 3  # number of times to find a job missing before
# declaring it dead

DEFAULT_AGENT_TYPE = "multicore"
DEFAULT_AGENT_SPAWNER = "POPEN"
DEFAULT_RP_VERSION = "local"
DEFAULT_VIRTENV = "%(global_sandbox)s/ve"
DEFAULT_VIRTENV_MODE = "update"
DEFAULT_AGENT_CONFIG = "default"

# ----------------------------------------------------------------------------
#
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__   = "GPL.v2"


# ------------------------------------------------------------------------------

from .session import Session
from .plotter import Plotter


# ------------------------------------------------------------------------------
# 
import os
import radical.utils as ru

pwd  = os.path.dirname (__file__)
root = "%s" % pwd
version_short, version_detail, version_base, \
        version_branch, sdist_name, sdist_path = ru.get_version(paths=[root])
version = version_short

logger = ru.Logger('radical.analytics')
logger.info('radical.analytics    version: %s' % version_detail)

# ------------------------------------------------------------------------------

Пример #14
0
import traceback
import threading
import tempfile

import saga
import radical.utils as ru

from ..states import *
from ..utils import logger
from ..utils import timestamp
from ..context import Context
from ..logentry import Logentry

pwd = os.path.dirname(__file__)
root = "%s/../" % pwd
_, _, _, rp_sdist_name, rp_sdist_path = ru.get_version([root, pwd])

IDLE_TIMER = 1  # seconds to sleep if notthing to do
JOB_CHECK_INTERVAL = 60  # seconds between runs of the job state check loop
JOB_CHECK_MAX_MISSES = 3  # number of times to find a job missing before
# declaring it dead

DEFAULT_AGENT_TYPE = 'multicore'
DEFAULT_AGENT_SPAWNER = 'POPEN'
DEFAULT_RP_VERSION = 'local'
DEFAULT_VIRTENV = '%(global_sandbox)s/ve'
DEFAULT_VIRTENV_MODE = 'update'
DEFAULT_AGENT_CONFIG = 'default'


# ----------------------------------------------------------------------------
Пример #15
0
# ------------------------------------------------------------------------------
#
import warnings
import os as _os
import radical.utils as _ru
import requests as req
from packaging.version import parse as parse_version


def custom_formatwarning(msg, *args, **kwargs):
    # ignore everything except the message
    return str(msg) + '\n'


warnings.formatwarning = custom_formatwarning

version_short, version_detail, version_base, version_branch, \
        sdist_name, sdist_path = _ru.get_version(_os.path.dirname(__file__))

version = version_short

r = req.get("https://pypi.org/pypi/radical.entk/json")
versions = r.json()["releases"].keys()
last_version = list(versions)[-1]
if parse_version(version) < parse_version(last_version):
    warnings.warn(
        "WARNING: You are using radical.entk version %s, however version %s is available."
        % (version, last_version), UserWarning)
# ------------------------------------------------------------------------------
Пример #16
0
__copyright__ = "Copyright 2013-2014, http://radical.rutgers.edu"
__license__ = "MIT"

# ------------------------------------------------------------------------------
# we *first* import radical.utils, so that the monkeypatching of the logger has
# a chance to kick in before the logging module is pulled by any other 3rd party
# module, and also to monkeypatch `os.fork()` for the `atfork` functionality
import radical.utils as _ru
import os as _os

# ------------------------------------------------------------------------------
# import NGE APIs
from nge_rp import NGE_RP
from nge_rs import NGE_RS

_mod_root = _os.path.dirname(__file__)

version_short, version_detail, version_base, \
               version_branch, sdist_name,   \
               sdist_path = _ru.get_version(_mod_root)
version = version_short

# ------------------------------------------------------------------------------
Пример #17
0
from overlay    import Pilot            # should be private
from overlay    import PilotDescription # should be private
from overlay    import Overlay
from overlay    import OverlayDescription
from overlay    import OverlayManager

from strategy   import manage_workload, execute_workload

# internal helper classes, exposed for plugin developers
from bundle_wrapper import BundleManager
from plugin_base    import PluginBase

# ------------------------------------------------------------------------------


pwd     = os.path.dirname (__file__)
root    = "%s/.." % pwd
short_version, long_version, branch = ru.get_version ([root, pwd])
version = long_version

# FIXME: the logger init will require a 'classical' ini based config, which is
# different from the json based config we use now.   May need updating once the
# radical configuration system has changed to json
_logger = rul.logger.getLogger  ('troy')
_logger.info ('troy            version: %s' % version)


# ------------------------------------------------------------------------------

Пример #18
0
import radical.utils as _ru
import os
from prof_utils import *

_pwd   = os.path.dirname (__file__)
_root  = "%s/.." % _pwd

version_short, version_detail, version_base, version_branch, \
        sdist_name, sdist_path = _ru.get_version([_root, _pwd])
version = version_short
Пример #19
0
#!/usr/bin/env python

# ------------------------------------------------------------------------------
#
# This example demonstrates the use of the Python code tracing facility.
#
# ------------------------------------------------------------------------------

import radical.utils as ru

ru.tracer.trace('radical')
print ru.get_version()
ru.tracer.untrace()