Skip to content
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

Feature : Print Debug Logs #629

Merged
merged 6 commits into from
Jan 13, 2023
Merged

Feature : Print Debug Logs #629

merged 6 commits into from
Jan 13, 2023

Conversation

Magnus167
Copy link
Member

@Magnus167 Magnus167 commented Jan 11, 2023

In case there is an unhandled exception or a failure when downloading/parsing/returning DF from JPMaQS.download, entire log stream (only from ms.download.jpmaqs.py and ...dataquery.py) will be printed to the users console.
In case there are errors with dataquery, these logs can be used as is to show the complete error.

By design, in case of an error all the logs are printed. However, if the user still needs debug logs, these can be printed by adding a print_debug_data=True param in the JPMaQS object init, or to JPMaQS.download.
eg:

with JPMaQSDownload(client_id=client_id, client_secret=client_secret, 
    print_debug_data=True,) as JPMaQS:
    start = timer()
    df = JPMaQS.download(
        tickers=tickers,
        start_date="2000-01-01",
        metrics=["value"],)
    end = timer()

...
or...

      df = JPMaQS.download(
         tickers=tickers,
         metrics=["value"],...)


eg output  (<XYZ>s are place holders) :


Number of expressions requested : 10
Number of missing time-series from the Database: 0.
-----------------------  DEBUG DATA  -----------------------
------------------------------------------------------------
2023-01-11 19:05:43,501 - INFO - jpmaqs - __init__ :: JPMaQSDownload object created.
2023-01-11 19:05:43,501 - INFO - jpmaqs - download :: Downloading 10 expressions from JPMaQS for 10 tickers & 1 metrics. Start date: 2000-01-01. End date: None.
2023-01-11 19:05:43,502 - INFO - dataquery - get_ts_expression :: Starting request for 10 expressions.
2023-01-11 19:05:43,502 - INFO - dataquery - _request :: Number of expressions requested : 10
2023-01-11 19:05:43,504 - INFO - dataquery - _fetch_threading :: Requesting ... <DQ URL and params> --track_id=8f647123-29b2-4ae7-aea4-54532ab048eb
2023-01-11 19:05:43,505 - INFO - dataquery - dq_request :: Requesting URL: <OAUTH TOKEN URL> , track_id: get_oauth_token
2023-01-11 19:05:44,949 - INFO - dataquery - dq_request :: Requesting URL: <Formed url form DQ URL and params> , track_id: --track_id=8f647123-29b2-4ae7-aea4-54532ab048eb
2023-01-11 19:05:53,929 - INFO - dataquery - _fetch_threading :: Request successful. --track_id=8f647123-29b2-4ae7-aea4-54532ab048eb
2023-01-11 19:05:53,930 - INFO - dataquery - get_ts_expression :: Finished request for 10 expressions.
2023-01-11 19:05:53,930 - INFO - dataquery - get_ts_expression :: All requested expressions were available.
2023-01-11 19:05:53,930 - INFO - jpmaqs - download :: Download complete. DataQuery interface closed.
2023-01-11 19:05:53,930 - INFO - jpmaqs - download :: No error tickers; Starting to data parse.
2023-01-11 19:05:53,957 - INFO - jpmaqs - download :: Data parse complete. Starting data validation.
2023-01-11 19:05:54,077 - INFO - jpmaqs - download :: Data validation complete. Starting to create and validate dataframe
2023-01-11 19:05:54,105 - INFO - jpmaqs - download :: Dataframe created and validated.
2023-01-11 19:05:54,105 - INFO - jpmaqs - download :: Returning dataframe and exiting JPMaQSDownload.download.
------------------------------------------------------------
------------------------------------------------------------

Download time from DQ: 0:00:10.609653
Last updated: 2023-01-11
  cid       xcat  real_date     value
0	.			.		.			.
1	.			.		.			.

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Base: 59.00% // Head: 59.09% // Increases project coverage by +0.09% 🎉

Coverage data is based on head (cc931f8) compared to base (4d04e2f).
Patch coverage: 64.28% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #629      +/-   ##
===========================================
+ Coverage    59.00%   59.09%   +0.09%     
===========================================
  Files           28       28              
  Lines         2949     2985      +36     
===========================================
+ Hits          1740     1764      +24     
- Misses        1209     1221      +12     
Impacted Files Coverage Δ
macrosynergy/download/jpmaqs.py 52.50% <60.00%> (+1.00%) ⬆️
macrosynergy/download/dataquery.py 32.53% <75.00%> (+1.68%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Magnus167 Magnus167 merged commit 5f5c55b into develop Jan 13, 2023
@Magnus167 Magnus167 deleted the feature/api_save_logs branch January 13, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants