Skip to content

Commit

Permalink
Revert "Feature/managed process" (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-merzky committed Apr 15, 2017
1 parent 33aa6e4 commit ab119d9
Show file tree
Hide file tree
Showing 16 changed files with 294 additions and 2,150 deletions.
56 changes: 46 additions & 10 deletions bin/radical-stack
@@ -1,16 +1,52 @@
#!/usr/bin/env python

import radical.utils as ru
import os
import sys
import glob
import pkgutil

stack = ru.stack()
print 'python : %s' % sys.version.split()[0]
print 'virtualenv : %s' % os.environ.get('VIRTUAL_ENV')

print
for key in sorted(stack['sys'].keys()):
print ' %-20s : %s' % (key, stack['sys'][key])
print
for key in sorted(stack['radical'].keys()):
print ' %-20s : %s' % (key, stack['radical'][key])
print
try:
import radical.utils as mod
print 'radical.utils : %s' % mod.version_detail
except:
pass

# ------------------------------------------------------------------------------
try:
import saga as mod
print 'saga-python : %s' % mod.version_detail
except:
pass

try:
import radical.saga as mod
print 'radical.saga : %s' % mod.version_detail
except:
pass

try:
import radical.pilot as mod
print 'radical.pilot : %s' % mod.version_detail
except:
pass

try:
import radical.entk as mod
print 'radical.entk : %s' % mod.version_detail
except:
pass

try:
import radical.ensembletk as mod
print 'radical.ensembletk: %s' % mod.version_detail
except:
pass

try:
import radical.analytics as mod
print 'radical.analytics : %s' % mod.version_detail
except:
pass

12 changes: 2 additions & 10 deletions bin/radical-stack-clone
Expand Up @@ -192,17 +192,13 @@ printf "%-20s %-55s %-30s %-30s %s\n" "mod" "repo" "branch" "commit" "tag"
#
if ! test -z "$stack"
then
for mod in 'radical.utils' 'radical.saga' 'saga' 'radical.pilot' 'radical.analytics'
for mod in 'radical.utils' 'saga-python' 'radical.pilot' 'radical.analytics'
do
info=$(cat $stack | grep -e "^$mod" | tail -n 1)
if test -z "$info"
then
echo "skip $mod"
else
if test "$mod" = "saga"
then
mod='saga-python'
fi
repo="https://github.com/radical-cybertools/$mod.git"

spec=$( echo "$info" | cut -f 2 -d ':' | xargs echo)
Expand All @@ -215,12 +211,8 @@ then
done

else
for mod in 'radical.utils' 'radical.saga' 'saga' 'radical.pilot' 'radical.analytics'
for mod in 'radical.utils' 'saga-python' 'radical.pilot' 'radical.analytics'
do
if test "$mod" = "saga"
then
mod='saga-python'
fi
repo="https://github.com/radical-cybertools/$mod.git"

install "$mod" "$repo" "$branch" "$tag" "$commit"
Expand Down
7 changes: 3 additions & 4 deletions setup.py 100755 → 100644
Expand Up @@ -2,11 +2,11 @@

__author__ = 'RADICAL Team'
__email__ = 'radical@rutgers.edu'
__copyright__ = 'Copyright 2013-16, RADICAL Research, Rutgers University'
__copyright__ = 'Copyright 2013/14, RADICAL Research, Rutgers University'
__license__ = 'MIT'


""" Setup script, only usable via pip. """
""" Setup script. Used by easy_install and pip. """

import re
import os
Expand Down Expand Up @@ -270,8 +270,7 @@ def isgood(name):
'cmdclass' : {
'test' : our_test,
},
'install_requires' : ['future',
'colorama',
'install_requires' : ['colorama',
'netifaces==0.10.4'
],
'extras_require' : {
Expand Down
13 changes: 5 additions & 8 deletions src/radical/utils/__init__.py
Expand Up @@ -3,20 +3,16 @@
__copyright__ = "Copyright 2013, RADICAL@Rutgers"
__license__ = "MIT"

# we want atfork imported first, specifically before os and logging
from .atfork import *

# import utility classes
from .object_cache import ObjectCache
from .plugin_manager import PluginManager
from .singleton import Singleton
from .process import Process
from .threads import Thread, RLock
from .threads import is_main_thread, is_this_thread, cancel_main_thread
from .threads import main_thread, this_thread
from .threads import Thread, RLock, NEW, RUNNING, DONE, FAILED
from .threads import is_main_thread, cancel_main_thread
from .threads import raise_in_thread, ThreadExit, SignalRaised
from .futures import Future
from .futures import NEW, RUNNING, DONE, FAILED, CANCELED
from .threads import fs_event_create, fs_event_wait
from .futures import *
from .url import Url
from .dict_mixin import DictMixin, dict_merge, dict_stringexpand
from .dict_mixin import PRESERVE, OVERWRITE
Expand All @@ -29,6 +25,7 @@
from .daemonize import Daemon

# import utility methods
from .atfork import *
from .logger import *
from .ids import *
from .read_json import *
Expand Down
3 changes: 0 additions & 3 deletions src/radical/utils/atfork/__init__.py
Expand Up @@ -48,7 +48,4 @@
from .atfork import monkeypatch_os_fork_functions, atfork
from .stdlib_fixer import fix_logging_module

fix_logging_module()
monkeypatch_os_fork_functions()


15 changes: 0 additions & 15 deletions src/radical/utils/atfork/atfork.py
Expand Up @@ -56,11 +56,6 @@ def monkeypatch_os_fork_functions():
Replace os.fork* with wrappers that use ForkSafeLock to acquire
all locks before forking and release them afterwards.
"""

# monkeypatching can be disabled by setting RADICAL_UTILS_NOATFORK
if 'RADICAL_UTILS_NOATFORK' in os.environ:
return

builtin_function = type(''.join)
if hasattr(os, 'fork') and isinstance(os.fork, builtin_function):
global _orig_os_fork
Expand Down Expand Up @@ -94,17 +89,10 @@ def atfork(prepare=None, parent=None, child=None):
they will be printed to sys.stderr after the fork call once it is safe
to do so.
"""

# monkeypatching can be disabled by setting RADICAL_UTILS_NOATFORK
if 'RADICAL_UTILS_NOATFORK' in os.environ:
return

assert not prepare or callable(prepare)
assert not parent or callable(parent)
assert not child or callable(child)

_fork_lock.acquire()

try:
if prepare:
_prepare_call_list.append(prepare)
Expand Down Expand Up @@ -205,6 +193,3 @@ def os_forkpty_wrapper():


# TODO: Also replace os.fork1() on Solaris.

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

8 changes: 0 additions & 8 deletions src/radical/utils/atfork/stdlib_fixer.py
Expand Up @@ -50,11 +50,6 @@ class Error(Exception):


def fix_logging_module():

import os
if 'RADICAL_UTILS_NOATFORK' in os.environ:
return

logging = sys.modules.get('logging')
# Prevent fixing multiple times as that would cause a deadlock.
if logging and getattr(logging, 'fixed_for_atfork', None):
Expand Down Expand Up @@ -88,6 +83,3 @@ def fork_safe_createLock(self):
logging.fixed_for_atfork = True
finally:
logging._releaseLock()

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

2 changes: 2 additions & 0 deletions src/radical/utils/debug.py
Expand Up @@ -108,6 +108,8 @@ def fs_block(self, info=None):

except Exception as e:
# we don't care (much)...
print get_trace()
print e
pass


Expand Down
2 changes: 1 addition & 1 deletion src/radical/utils/futures.py
Expand Up @@ -40,7 +40,7 @@
class Future(mt.Thread):
"""
This `Future` class is a thin wrapper around Python's native `mt.Thread`
class. It is expected to wrap a callable, and to watch its execution.
class. It is expeted to wrap a callable, and to watch its execution.
"""

# FIXME: we may want to use a thread pool to limit the number of threads
Expand Down
15 changes: 9 additions & 6 deletions src/radical/utils/logger.py
Expand Up @@ -39,6 +39,10 @@

from .atfork import *

# monkeypatching can be disabled by setting RADICAL_UTILS_NOATFORK
if not 'RADICAL_UTILS_NOATFORK' in os.environ:
stdlib_fixer.fix_logging_module()
monkeypatch_os_fork_functions()

# ------------------------------------------------------------------------------
#
Expand Down Expand Up @@ -88,7 +92,8 @@ def _atfork_parent():
def _atfork_child():
_after_fork()

atfork(_atfork_prepare, _atfork_parent, _atfork_child)
if not 'RADICAL_UTILS_NOATFORK' in os.environ:
atfork(_atfork_prepare, _atfork_parent, _atfork_child)

#
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -181,8 +186,6 @@ def get_logger(name, target=None, level=None, path=None, header=True):
'name' is used to identify log entries on this handle.
'target' is a comma separated list (or Python list) of specifiers, where
specifiers are:
'0' : /dev/null
'null' : /dev/null
'-' : stdout
'1' : stdout
'stdout' : stdout
Expand Down Expand Up @@ -299,9 +302,9 @@ def get_logger(name, target=None, level=None, path=None, header=True):
# add a handler for each targets (using the same format)
logger.targets = targets
for t in logger.targets:
if t in ['0', 'null']:
handle = logging.NullHandler()
elif t in ['-', '1', 'stdout']:
if t in ['null']:
continue
if t in ['-', '1', 'stdout']:
handle = ColorStreamHandler(sys.stdout)
elif t in ['=', '2', 'stderr']:
handle = ColorStreamHandler(sys.stderr)
Expand Down
31 changes: 0 additions & 31 deletions src/radical/utils/misc.py
@@ -1,11 +1,9 @@
import os
import sys
import time
import glob
import regex
import signal
import socket
import importlib
import netifaces
import threading
import url as ruu
Expand Down Expand Up @@ -483,34 +481,5 @@ def name2env(name):
return name.replace('.', '_').upper()


# ------------------------------------------------------------------------------
#
def stack():

ret = {'sys' : {'python' : sys.version.split()[0],
'pythonpath' : os.environ.get('PYTHONPATH', ''),
'virtualenv' : os.environ.get('VIRTUAL_ENV', '')},
'radical' : dict()
}


modules = ['radical.utils',
'radical.saga',
'saga',
'radical.pilot',
'radical.entl',
'radical.ensembletk',
'radical.analytics']

for mod in modules:
try:
tmp = importlib.import_module(mod)
ret['radical'][mod] = tmp.version_detail
except:
pass

return ret


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

0 comments on commit ab119d9

Please sign in to comment.