Skip to content

Commit

Permalink
#146: Add logging for ISIS endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Oct 15, 2020
1 parent b52634a commit 1652048
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion common/icat/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def get_facility_cycles_for_instrument(
:type count_query: :class:`bool`
:return: A list of Facility Cycles that match the query
"""
# TODO - Add logging
log.info("Getting a list of facility cycles from the specified instrument for ISIS")

query_aggregate = "COUNT:DISTINCT" if count_query else "DISTINCT"
query = ICATQuery(
Expand Down Expand Up @@ -532,6 +532,9 @@ def get_facility_cycles_for_instrument_count(client, instrument_id, filters):
:type filters: List of specific implementations :class:`QueryFilter`
:return: The number of Facility Cycles that match the query
"""
log.info(
"Getting the number of facility cycles from the specified instrument for ISIS"
)
return get_facility_cycles_for_instrument(
client, instrument_id, filters, count_query=True
)[0]
Expand All @@ -558,6 +561,11 @@ def get_investigations_for_instrument_in_facility_cycle(
:type count_query: :class:`bool`
:return: A list of Investigations that match the query
"""
log.info(
"Getting a list of investigations from the specified instrument and facility"
" cycle, for ISIS"
)

query_aggregate = "COUNT:DISTINCT" if count_query else "DISTINCT"
query = ICATQuery(
client, "Investigation", aggregate=query_aggregate, isis_endpoint=True
Expand Down Expand Up @@ -615,6 +623,10 @@ def get_investigations_for_instrument_in_facility_cycle_count(
:type filters: List of specific implementations :class:`QueryFilter`
:return: The number of Investigations that match the query
"""
log.info(
"Getting the number of investigations from the specified instrument and"
" facility cycle, for ISIS"
)
return get_investigations_for_instrument_in_facility_cycle(
client, instrument_id, facilitycycle_id, filters, count_query=True
)[0]

0 comments on commit 1652048

Please sign in to comment.