-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for running as an API server. #35
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cleaned up imports. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- Only use `winpty` when running interactively on Windows. - This fixes the `stdout is not a tty` issue seen on Windows when piping the output of the script to a file. - For example; `./run.sh --net smn --status > status.json` Removed all trailing white-space from network names. Added network name and consistent timestamp to node summary. - Add the network name to the node summary so monitoring results can be filtered and grouped by network. - Ensure there is a consistent (UTC) timestamp on the results that can be used as the time series for the collected data. This ensures events can be compared across nodes regardless of any clock skew on the nodes themselves. Updated run script. - Add support for specifying the number of samples to collect via an environment variable (default 1); `SAMPLES`. - Samples are taken one minute apart as the Nodes refresh their own data every minute. - Add support for logging results directly to a timestamped file via an environment variable; `LOG`. Full Example: `SAMPLES=20 LOG=/c/tick-sandbox/telegraf/indy-node-monitor/BuilderNet/BuilderNet-AllNodes.json ./run.sh --net sbn --seed <seed>` - Runs the `fetch_status` process 20 times (once every minute) producing a set of files in `/c/tick-sandbox/telegraf/indy-node-monitor/BuilderNet/` with a timestamped filename that looks like this; `BuilderNet-AllNodes_2021-05-23_06-48-20.json`. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- Added function init_network_args_test. This function returns a tuple with the network info. - Added more logging to pool connection. - Added asyncio to requirements.txt - Minor clean-up. - Removed Commented code. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
fetch_status.py - Added parser arg to start Fast API - Moved default for genesis_path to fetch_status_library.py in init_network_args so it can be used by the command line and REST API fetch_status_library.py - Added return to fetch_status - Added default for genesis_path run.sh - Opened port Added requirements Cleaned up imports. Fixed fetch_status_library.py verbose not being enabled when using REST API. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Created did helper function. Created separate instances for plug-ins in REST API. One to set default args and one for a separate user instance. Added and fixed logging. Fixed results being printed to console when running REST API. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- Fetch status renamed to main. - Fetch status library renamed to fetch status. - Fetching of pool connection and fetch status are now classes. - Created util file for helper functions. - Fixed and added logging. - Removed some imports and requirements. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
…ti request errors when running REST API. Added Singleton meta class to Pool class to have a global pool cache. Added refactoring Notes. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Fixed import in pool.py Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Singleton meta class now has its own file. Changed string manipulation in fetch pool connection for something better. Added genesis path and url to fetch status class. Added comments. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- Pull the known network related code out into it's own class; Networks - Refactor network and pool resolution to use network ids. - Update dependent code. Testing is not complete Signed-off-by: Wade Barnes <wade@neoterictech.ca>
Renamed Networks.get_names to Networks.get_ids, and Networks.get_all to Networks.get_details. Renamed status_test to node_info and cleaned up global variables in rest_api.py. Fixed comments and logs. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
6d50c62
to
fb2e68a
Compare
- Created an exception for when a requested node is not found on the requested network. - Refactored Pool.resolve to deal with genesis url's using the new Networks class. - Cleaned up pool cacheing. - Clean-up variable names and logging messages. - Add redirect to API, from `/` to `/docs`. Signed-off-by: Wade Barnes <wade@neoterictech.ca> Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- Removed import argparse ArgumentError. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
- uvicorn for debug. - gunicorn for production. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Added code to check if a seed is being used while running the REST API. If so it will exit. Changed App name and description. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Add API documentation. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
…e Networks. Signed-off-by: KoleBarnes <kbarnes261@gmail.com>
fb2e68a
to
01acb3c
Compare
WadeBarnes
approved these changes
Dec 24, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: KoleBarnes kbarnes261@gmail.com