PANOPTES Utilities¶
Utility functions for use within the PANOPTES ecosystem and for general astronomical processing.
This library defines a number of modules that contain useful functions as well as a few services.
Getting¶
See Docker for ways to run panoptes-utils
services without installing to your host computer.
Using¶
Modules¶
The modules can be used as helper utilities anywhere you would like.
Services¶
The services can be run either from a Docker image or from the installed script, as described below.
Config Server¶
A simple config param server. Runs as a Flask microservice that delivers JSON documents in response to requests for config key items.
Can be run from the installed script (defaults to http://localhost:6563/get-config
):
$ panoptes-config-server -h
usage: panoptes-config-server [-h] [--host HOST] [--port PORT] [--public] [--config-file CONFIG_FILE] [--no-save] [--ignore-local] [--debug]
Start the config server for PANOPTES
optional arguments:
-h, --help show this help message and exit
--host HOST Host name, defaults to local interface.
--port PORT Local port, default 6563
--public If server should be public, default False. Note: inside a docker container set this to True to expose to host.
--config-file CONFIG_FILE
Config file, default $PANDIR/conf_files/pocs.yaml
--no-save Prevent auto saving of any new values.
--ignore-local Ignore the local config files, default False. Mostly for testing.
--debug Debug
Or inside a python process:
>>> from panoptes.utils.config.server import config_server
>>> from panoptes.utils.config import client
>>> server_process=config_server()
>>> client.get_config('location.horizon')
30.0
>>> server_process.terminate() # Or just exit notebook/console
For more details and usage examples, see the Config Server.
Development¶
Environment¶
Most users of panoptes-utils
who need the full environment will also
want the fulle POCS Environment.
Logging¶
The panoptes-utils
module uses loguru for logging, which also
serves as the basis for the POCS logger (see Logger).
To access the logs for the module, you can import directly from the
logger
module, i.e., from panoptes.utils.logger import logger
.
This is a simple wrapper around luguru
with no extra configuration:
>>> from panoptes.utils import CountdownTimer
>>> # No logs by default
>>> t0 = CountdownTimer(5)
>>> t0.sleep()
False
>>> # Enable the logs
>>> from panoptes.utils.logger import logger
>>> logger.enable('panoptes')
>>> t1 = CountdownTimer(5)
2020-03-04 06:42:50 | DEBUG | panoptes.utils.time:restart:162 - Restarting Timer (blocking) 5.00/5.00
>>> t1.sleep()
2020-03-04 06:42:53 | DEBUG | panoptes.utils.time:sleep:183 - Sleeping for 2.43 seconds
False
Contents¶
- Config Server
- Docker
- License
- Authors
- Changelog
- 0.2.29dev
- 0.2.28 - 2020-09-15
- 0.2.27 - 2020-09-12
- 0.2.26 - 2020-08-21
- 0.2.25 - 2020-08-20
- 0.2.23 - 2020-08-16
- 0.2.22 - 2020-07-25
- 0.2.21 - 2020-07-05
- 0.2.20 - 2020-06-09
- 0.2.19 - 2020-06-04
- 0.2.17 - 2020-05-30
- 0.2.15 - 2020-05-26
- 0.2.14 - 2020-05-23
- 0.2.13 - 2020-05-14
- 0.2.12 - 2020-04-29
- 0.2.11 - 2020-04-29
- 0.2.10 - 2020-04-13
- 0.2.9 - 2020-03-27
- 0.2.8 - 2020-03-27
- 0.2.7 - 2020-03-22 (hotfix)
- 0.2.6 - 2020-03-22
- 0.2.5 - 2020-03-18
- 0.2.4 - 2020-03-11
- 0.2.3 - 2020-03-08
- 0.2.2 - 2020-03-05
- 0.2.0 - 2020-03-04
- 0.1.0 - 2020-03-04
- 0.0.8 - 2019-06-29
- 0.0.7 - 2019-05-26
- 0.0.6 - 2019-04-29
- 0.0.5 - 2019-04-09
- Module Reference