Commit 8c1ac400 authored by julian.gethmann's avatar julian.gethmann

Fix typo

parent ba7212f7
......@@ -7,6 +7,7 @@ Changelog
0.7.3 (2018-06-)
------------------
* Add `fillingpattern` PV
* Add `connected` command line tool
0.7.2 (2018-05-25)
------------------
......
# Since 2016-02-09 the following PIs should be available in Cassandra/DB
# Since 2016-02-09 the following PVs should be available in Cassandra/DB
A:ID-S1:Wig:01:Field:Readback
A:ID-S1:Wig:01:Field:Setpoint
A:ID-S1:Wig:01:JB:LiquidHe:Level
......
......@@ -16,6 +16,7 @@ from setuptools import setup
entry_points = """
[console_scripts]
get_mean_values = cassandra.tools:get_mean_values
connected_archive = cassandra.tools:connected_to_archive
"""
if sys.version_info <= (3,):
requires = ['pyscaffold==2.5.10']
......@@ -24,6 +25,7 @@ else:
def setup_package():
# type: (...) -> None
needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv)
sphinx = ['sphinx'] if needs_sphinx else []
setup(setup_requires=requires + sphinx, entry_points=entry_points, use_pyscaffold=True)
......
......@@ -11,6 +11,8 @@ import logging
from math import sqrt
from typing import Optional, Tuple, Union # flake8: noqa
from cassandra import __version__
from .cassandra import Cassandra, Pvs
_logger = logging.getLogger("cassandra.tools")
......@@ -105,6 +107,13 @@ def get_mean_values():
const=True,
default=False,
help="print the raw string instead of the mean value")
parser.add_argument(
"--version",
"-v",
action="version",
help="Show version of this tool",
version="cassandra {ver}".format(ver=__version__))
args = parser.parse_args()
if args.raw:
......@@ -122,6 +131,43 @@ def get_mean_values():
_get_mean_values(args.start_time[0], end_time, pvs, output_format=out_form)
def connected_to_archive():
# type: (...) -> Optional[int]
"""
.. versionadded: 0.7.3
"""
parser = argparse.ArgumentParser(description="Return if one can connect to " "the archive.")
parser.add_argument(
"--quiet",
"-q",
action="store_const",
const=True,
default=False,
help="If this flag is set, then no output is print on stdout, but"
r"only the return type is 0 for connected or 1 for disconnected. \nBe "
"aware that this does not sound logical, but sticks to the "
"convention that 0 is ok!")
parser.add_argument(
"--version",
"-v",
action="version",
help="Show version of this tool",
version="cassandra {ver}".format(ver=__version__))
args = parser.parse_args()
conn = Cassandra.check_connection()
if conn:
message = "You are connected. OK."
status = 0
else:
message = "You are not connected correctly."
status = 1
if not args.quiet:
print(message)
return status
if __name__ == "__main__":
get_mean_values()
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment