<#3166 Add get metrics for flyteRemote and add hel...
# flyte-github
a
#3166 Add get metrics for flyteRemote and add helper method explain/dump Pull request opened by troychiu Why are the changes needed? Users were not allowed to use flyteRemote to access execution metrics but just pyflyte cli. What changes were proposed in this pull request? In this PR, I added get_execution_metrics for flyteRemote as well as helper method explain and dump as we did for pyflyte cli How was this patch tested? # Get an execution r = FlyteRemote() execs = r.recent_executions(project=project, domain=domain, limit=limit) a = r.sync(execs[0], sync_nodes=True) # Get the metrics for the execution metrics = r.get_execution_metrics(id=a.id, depth=10) metrics.explain() metrics.dump() Output
Copy code
operation                start_timestamp          end_timestamp             duration    entity
--------------------------------------------------------------------------------------------------------------------------------------------
WORKFLOW_SETUP           02-28 15:31:49.683640    02-28 15:31:50.744600        1.06s    workflow/an9wrv6dv4f5652vvsm6
NODE_TRANSITION          02-28 15:31:50.744600    02-28 15:31:50.791467        0.05s      node/n0
NODE_SETUP               02-28 15:31:50.791467    02-28 15:31:50.936493        0.15s      node/n0
NODE_TRANSITION          02-28 15:31:50.936493    02-28 15:31:51.065847        0.13s        node/n0-0-n0
NODE_SETUP               02-28 15:31:51.065847    02-28 15:31:51.196446        0.13s        node/n0-0-n0
TASK_SETUP               02-28 15:31:51.196446    02-28 15:31:52.000000        0.80s          task/0
TASK_RUNTIME             02-28 15:31:52.000000    02-28 15:32:05.000000       13.00s          task/0
TASK_TEARDOWN            02-28 15:32:05.000000    02-28 15:32:05.859117        0.86s          task/0
NODE_TEARDOWN            02-28 15:32:05.859117    02-28 15:32:05.897419        0.04s        node/n0-0-n0
NODE_TRANSITION          02-28 15:32:05.897419    02-28 15:32:05.966038        0.07s        node/n0-0-n1
NODE_SETUP               02-28 15:32:05.966038    02-28 15:32:06.092022        0.13s        node/n0-0-n1
TASK_SETUP               02-28 15:32:06.092022    02-28 15:32:06.000000       -0.09s          task/0
TASK_RUNTIME             02-28 15:32:06.000000    02-28 15:32:15.000000        9.00s          task/0
TASK_TEARDOWN            02-28 15:32:15.000000    02-28 15:32:16.867042        1.87s          task/0
NODE_TEARDOWN            02-28 15:32:16.867042    02-28 15:32:16.925290        0.06s        node/n0-0-n1
NODE_TRANSITION          02-28 15:32:16.925290    02-28 15:32:16.987092        0.06s        node/n0-0-n2
NODE_SETUP               02-28 15:32:16.987092    02-28 15:32:17.128484        0.14s        node/n0-0-n2
TASK_SETUP               02-28 15:32:17.128484    02-28 15:32:17.000000       -0.13s          task/0
TASK_RUNTIME             02-28 15:32:17.000000    02-28 15:32:27.000000       10.00s          task/0
TASK_TEARDOWN            02-28 15:32:27.000000    02-28 15:32:27.875829        0.88s          task/0
NODE_TEARDOWN            02-28 15:32:27.875829    02-28 15:32:27.910749        0.03s        node/n0-0-n2
...
an9wrv6dv4f5652vvsm6:
  breakdown:
    NODE_RESET: 0.310305
    NODE_SETUP: 1.131463
    NODE_TEARDOWN: 0.7822120000000001
    NODE_TRANSITION: 0.618606
    TASK_RUNTIME: 75.0
    TASK_SETUP: 1.482033
    TASK_TEARDOWN: 9.148048
    WORKFLOW_SETUP: 1.06096
    WORKFLOW_TEARDOWN: 0.255248
  nodes:
    n0:
      breakdown:
        NODE_RESET: 0.310305
        NODE_SETUP: 0.691576
        NODE_TEARDOWN: 0.6910450000000001
        NODE_TRANSITION: 0.416071
        TASK_RUNTIME: 42.0
        TASK_SETUP: 0.46119
        TASK_TEARDOWN: 4.465164
      nodes:
        n0-0-n0:
          breakdown:
            NODE_SETUP: 0.130599
            NODE_TEARDOWN: 0.038302
            NODE_TRANSITION: 0.129354
            TASK_RUNTIME: 13.0
            TASK_SETUP: 0.803554
            TASK_TEARDOWN: 0.859117
          task_attempts:
            0:
              breakdown:
                TASK_RUNTIME: 13.0
                TASK_SETUP: 0.803554
                TASK_TEARDOWN: 0.859117
        ...
Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Docs link flyteorg/flytekit
c