initial version

This commit is contained in:
2020-10-23 16:18:50 +02:00
parent c5f9c12e98
commit 61ba9336b8
11 changed files with 1112 additions and 1 deletions

55
bin/frappy Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
import sys
from os.path import join, abspath
sys.path.insert(1, abspath(join(__file__, '../../..')))
from servman.frappy import FrappyManager
from servman.nicos import NicosManager
from servman.sea import SeaManager
from servman import run
NicosManager()
serv = FrappyManager()
SeaManager()
USAGE = """
Usage:
frappy list [<instance>]
frappy start <instance> <service> <cfgfiles>
frappy restart <instance> [<service>] [<cfgfiles>]
frappy stop <instance> [<service>]
<service> is one of main, stick, addons
<instance> is one of %s
""" % ', '.join(serv.info)
try:
run(serv, sys.argv[1:])
except Exception as e:
print(repr(e))
print(''.join(USAGE))

71
bin/nicos Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
import os
from os.path import join, abspath, expanduser
import sys
#nicos_root = os.environ.get('NICOS_ROOT', expanduser('~/nicos'))
#pkg_dir = abspath(join(nicos_root, 'nicos_linse'))
#sys.path.insert(1, join(pkg_dir, 'common'))
sys.path.insert(1, abspath(join(__file__, '../../..')))
from servman.frappy import FrappyManager
from servman.nicos import NicosManager
from servman.sea import SeaManager
from servman import run, UsageError
serv = NicosManager()
FrappyManager()
SeaManager()
USAGE = """
Usage:
nicos gui <instance>
nicos <instance> (the same as above)
nicos list [<instance>]
nicos start <instance> [<service>]
nicos restart <instance> [<service>]
nicos stop <instance> [<service>]
nicos create <instance> <nr>
nicos create all
nicos link <instance> (create links to nicos data and scripts)
<service> is one of main, stick, addons
<instance> is one of %s
to be done after the experiment:
nicos copy (copy data and scripts from link)
nicos copy [<instance> [<year>/<proposal>]] (copy specific data)
""" % ', '.join(serv.info)
try:
run(serv, sys.argv[1:])
except UsageError as e:
print(repr(e))
print(''.join(USAGE))

62
bin/nicos-cache Executable file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2019 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Georg Brandl <georg.brandl@fz-juelich.de>
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
from __future__ import absolute_import, division, print_function
import argparse
import sys
from os import path, environ
sys.path.insert(0, path.dirname(path.dirname(path.dirname(path.realpath(__file__)))))
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
help='daemonize the cache process')
parser.add_argument('-D', '--systemd', dest='daemon', action='store_const',
const='systemd', help='run in systemd service mode')
parser.add_argument('-S', '--setup', action='store', dest='setupname',
default='cache',
help="name of the setup, default is 'cache'")
parser.add_argument('--clear', dest='clear', action='store_true',
default=False,
help='clear the whole cache')
parser.add_argument('-I', '--instrument', action='store',
type=str, default='',
help='instrument as <package>.<instrument>\n', )
parser.add_argument('args', nargs=argparse.REMAINDER, help=argparse.SUPPRESS)
opts = parser.parse_args()
if opts.clear:
opts.args.append('clear')
if opts.instrument:
environ['INSTRUMENT'] = opts.instrument
from nicos.core.sessions.simple import NoninteractiveSession
NoninteractiveSession.run(opts.setupname, 'Server', setupname=opts.setupname,
daemon=opts.daemon, start_args=opts.args)

54
bin/nicos-daemon Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2019 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Georg Brandl <georg.brandl@fz-juelich.de>
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
from __future__ import absolute_import, division, print_function
import argparse
import sys
from os import path, environ
sys.path.insert(0, path.dirname(path.dirname(path.dirname(path.realpath(__file__)))))
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
help='daemonize the daemon process')
parser.add_argument('-D', '--systemd', dest='daemon', action='store_const',
const='systemd', help='run in systemd service mode')
parser.add_argument('-S', '--setup', action='store', dest='setupname',
default='daemon',
help="name of the setup, default is 'daemon'")
parser.add_argument('-I', '--instrument', action='store',
type=str, default='',
help='instrument as <package>.<instrument>\n', )
opts = parser.parse_args()
if opts.instrument:
environ['INSTRUMENT'] = opts.instrument
from nicos.services.daemon.session import DaemonSession
DaemonSession.run(opts.setupname, 'Daemon', daemon=opts.daemon)

63
bin/nicos-poller Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2019 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Georg Brandl <georg.brandl@fz-juelich.de>
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
from __future__ import absolute_import, division, print_function
import argparse
import sys
from os import path, environ
sys.path.insert(0, path.dirname(path.dirname(path.dirname(path.realpath(__file__)))))
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
help='daemonize the poller processes')
parser.add_argument('-D', '--systemd', dest='daemon', action='store_const',
const='systemd', help='run in systemd service mode')
parser.add_argument('-S', '--setup', action='store', dest='setupname',
default='poller',
help="name of the setup, default is 'poller'")
parser.add_argument('-I', '--instrument', action='store',
type=str, default='',
help='instrument as <package>.<instrument>\n', )
parser.add_argument('setup', nargs=argparse.OPTIONAL, help=argparse.SUPPRESS)
opts = parser.parse_args()
if opts.setup:
appname = 'poller-' + opts.setup
args = [opts.setup]
else:
appname = 'poller'
args = []
if opts.instrument:
environ['INSTRUMENT'] = opts.instrument
from nicos.services.poller.psession import PollerSession
PollerSession.run(appname, setupname=opts.setupname, maindevname='Poller',
start_args=args, daemon=opts.daemon)

58
bin/sea Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
import os
from os.path import join, abspath, split, dirname, expanduser
import sys
nicos_root = os.environ.get('NICOS_ROOT', expanduser('~/nicos'))
pkg_dir = abspath(join(nicos_root, 'nicos_linse'))
sys.path.insert(1, join(pkg_dir, 'common'))
from clitools import FrappyManager, NicosManager, SeaManager, run
NicosManager(pkg_dir)
FrappyManager(pkg_dir)
serv = SeaManager()
USAGE = """
Usage:
sea gui <instance>
sea <instance> # the same as sea gui <instance>
sea cli <instance> (the same as old seacmd)
sea start <instance> <service>
sea restart <instance> [<service>]
sea stop <instance> [<service>]
sea list [<instance>]
<service> is one of main, stick, addons
<instance> is one of %s
""" % ', '.join(serv.info)
try:
run(serv, sys.argv[1:])
except Exception as e:
print(repr(e))
print(''.join(USAGE))