當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Python ArcGIS ReportManager.quick_report用法及代碼示例


本文簡要介紹 python 語言中 arcgis.gis.server.ReportManager.quick_report 的用法。

用法:

quick_report(since='LAST_WEEK', queries='services/', metrics='RequestsFailed')

返回:

成功查詢的 Python 數據字典。

為服務、服務或文件夾生成動態使用情況報告。

Parameter

Description

since

可選字符串。報告的持續時間。支持的值為:LAST_DAY、LAST_WEEK、LAST_MONTH 或 LAST_YEAR。

  • LAST_DAY 表示跨越前 24 小時的時間範圍。這是默認值。

  • LAST_WEEK 表示跨越前 7 天的時間範圍。

  • LAST_MONTH 表示跨越前 30 天的時間範圍。

  • LAST_YEAR 表示跨越前 365 天的時間範圍。

queries

必需的字符串。要為其生成報告的資源URI 字符串。指定為要為其收集指標的服務或文件夾的逗號分隔字符串。

  • services/ - Entire Site

  • services/Folder/ - Folder within a Site. Reports metrics aggregated across all services within that Folder and Sub-Folders.

  • services/Folder/ServiceName.ServiceType - Service in a specified folder, for example:

    • services/Folder_Name/Map_bv_999.MapServer

    • services/Fodler_Name/ServiceName.ServiceType

  • root folder - Service in the root folder
    • Map_bv_999.MapServer.

queries="services/Hydroligic_Data/Lake_algae.FeatureServer,services/Mountains"

metrics

可選字符串。要報告的指標的逗號分隔列表。

支持的指標是:

  • RequestCount - the number of requests received

  • RequestsFailed - the number of requests that failed

  • RequestsTimedOut - the number of requests that timed out

  • RequestMaxResponseTime - the maximum response time

  • RequestAvgResponseTime - the average response time

  • ServiceActiveInstances - the maximum number of active (running) service instances sampled at 1 minute intervals, for a specified service

metrics="RequestCount,RequestsFailed"

例子:

# Usage Example:

>>> gis = GIS(profile="my_own_portal", verify_cert=False)

>>> gis_servers = gis.admin.servers.list()

>>> srv = gis_servers[0]

>>> query_string = "services/Forests/Forests_degraded_2000.MapServer,services/Lakes/Lakes_drought_levels.MapServer"
>>> qk_report = srv.usage.quick_report(since = "LAST_MONTH",
                                       queries = query_string,
                                       metrics = "RequestCount,RequestsFailed")

>>> qk_report

    {'report': {'reportname': '1fa828eb31664485ae5c25c76c86e28d',
                'metadata': '{"temp":true,"title":"1fa828eb31664485ae5c25c76c86e28d","managerReport":false}',
                'time-slices': [1598914800000, 1599001200000, 1599087600000, ... 1601420400000],
                'report-data': [[{'resourceURI': 'services/Forests/Forests_degraded_2000.MapServer',
                                  'metric-type': 'RequestCount', 'data': [None, 17, 928, ... 20]},
                                 {'resourceURI': 'services/Forests/Forests_degraded_2000.MapServer',
                                  'metric-type': 'RequestsFailed', 'data': [None, 225, None, ... 0]},
                                 {'resourceURI': 'services/Lakes/Lakes_drought_levels.MapServer',
                                  'metric-type': 'RequestCount', 'data': [0, 0, 7, ... 71]},
                                 {'resourceURI': 'services/Lakes/Lakes_drought_levels.MapServer',
                                  'metric-type': 'RequestsFailed', 'data': [None, None, 1 ... , 0]}]]}}

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.gis.server.ReportManager.quick_report。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。