예제 #1
0
    def register_app(self, app_id):
        """Register a new long-running app process.
        """
        global job_manager
        if app_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', app_id)
            if app_id.find(':') == -1:
                job_manager.register_job(app_id)
            self._event('register_app', app_id)
예제 #2
0
    def register_app(self, app_id):
        """Register a new long-running app process.
        """
        global job_manager
        if app_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', app_id)
            if app_id.find(':') == -1:
                job_manager.register_job(app_id)
            self._event('register_app', app_id)
예제 #3
0
    def register_job(self, job_id):
        """Register a new long-running job.
        """
        global job_manager
        if job_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', job_id)
            # njs jobs start with either
            # 'njs:' or 'method:' - either way
            # they're the only ones with a colon
            if job_id.find(':') == -1:
                job_manager.register_job(job_id)
            self._event('register_job', job_id)
예제 #4
0
    def register_job(self, job_id):
        """Register a new long-running job.
        """
        global job_manager
        if job_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', job_id)
            # njs jobs start with either
            # 'njs:' or 'method:' - either way
            # they're the only ones with a colon
            if job_id.find(':') == -1:
                job_manager.register_job(job_id)
            self._event('register_job', job_id)
예제 #5
0
    def register_app(self, app_id):
        """Register a new long-running app process.
        """
        global job_manager
        if app_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', app_id)
            try:
                unprefixed_app_id = app_id
                if app_id.find(':') >= 0:
                    unprefixed_app_id = app_id.split(':')[1]
                job_manager.register_job(unprefixed_app_id)
            except Exception as e:
                # It should be logged somehow
                to_log = type(e).__name__ + ': ' + str(e) + '\n' + traceback.format_exc()
                self._event('debug', to_log)
            self._event('register_app', app_id)
예제 #6
0
    def register_app(self, app_id):
        """Register a new long-running app process.
        """
        global job_manager
        if app_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', app_id)
            try:
                unprefixed_app_id = app_id
                if app_id.find(':') >= 0:
                    unprefixed_app_id = app_id.split(':')[1]
                job_manager.register_job(unprefixed_app_id)
            except Exception as e:
                # It should be logged somehow
                to_log = type(e).__name__ + ': ' + str(
                    e) + '\n' + traceback.format_exc()
                self._event('debug', to_log)
            self._event('register_app', app_id)
예제 #7
0
    def register_job(self, job_id):
        """Register a new long-running job.
        """
        global job_manager
        if job_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', job_id)
            # njs jobs start with either
            # 'njs:' or 'method:' - either way
            # they're the only ones with a colon
            try:
                unprefixed_job_id = job_id
                if job_id.find(':') >= 0:
                    unprefixed_job_id = job_id.split(':')[1]
                job_manager.register_job(unprefixed_job_id)
            except Exception as e:
                to_log = type(e).__name__ + ': ' + str(e) + '\n' + traceback.format_exc()
                self._event('debug', to_log)
            self._event('register_job', job_id)
예제 #8
0
    def register_job(self, job_id):
        """Register a new long-running job.
        """
        global job_manager
        if job_id is not None:
            if job_manager is None:
                job_manager = KBjobManager()

            self._event('debug', job_id)
            # njs jobs start with either
            # 'njs:' or 'method:' - either way
            # they're the only ones with a colon
            try:
                unprefixed_job_id = job_id
                if job_id.find(':') >= 0:
                    unprefixed_job_id = job_id.split(':')[1]
                job_manager.register_job(unprefixed_job_id)
            except Exception as e:
                to_log = type(e).__name__ + ': ' + str(
                    e) + '\n' + traceback.format_exc()
                self._event('debug', to_log)
            self._event('register_job', job_id)
예제 #9
0
    def poll_job(self, job_id):
        global job_manager
        if job_manager is None:
            job_manager = KBjobManager()

        return job_manager.poll_job(job_id)
예제 #10
0
    def poll_job(self, job_id):
        global job_manager
        if job_manager is None:
            job_manager = KBjobManager()

        return job_manager.poll_job(job_id)
예제 #11
0
import traceback
# Third-party
import traitlets as trt
# from IPython.core.application import Application
# Local
from biokbase.narrative.common import kbtypes, kblogging
from biokbase.narrative.common.log_common import EVENT_MSG_SEP
from biokbase.narrative.common.url_config import URLS
from biokbase.narrative.common import util
from biokbase.narrative.common.kbjob_manager import KBjobManager

# Logging
_log = logging.getLogger(__name__)

# Init job manager
job_manager = KBjobManager()

## Exceptions


class ServiceError(Exception):
    """Base class for Service errors.
    Should not normally be instantiated directly.
    """
    def __init__(self, errmsg):
        Exception.__init__(self, errmsg)
        self._info = {
            'severity': 'FATAL',
            'type': self.__class__.__name__,
            'msg': str(errmsg)
        }