当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。