Openwhisk: show "start" value in activation in a human-readable format

Created on 27 Jul 2016  路  22Comments  路  Source: apache/openwhisk

cli enhancement

Most helpful comment

` $ wsk activation list ActivationID Name Status StartTime Duration d8a139f69c1f48d980326ee88bbdcb29 action-invoke-nodejsdefault-1492092980162 Success 2017-04-13 14:16:20 +0000 UTC 62 b477d80f59ba443ea475c8d4637c0635 action-invoke-nodejsdefault-1492092980162 Success 2017-04-13 14:16:20 +0000 UTC 45 7a0616fb75064e7287c8f96fbf42987c robi02 Failure 2017-04-13 14:16:09 +0000 UTC 3 24b7af4ff85f48028a1bfc6680fd0160 action-invoke-nodejsdefault-1492092920140 Success 2017-04-13 14:15:20 +0000 UTC 83 4e389a2ebb564d49a7ea78756f43e856 action-invoke-nodejsdefault-1492092920140 Success 2017-04-13 14:15:20 +0000 UTC 47 0eea632914434325986b0b5af2f5090c action-invoke-nodejsdefault-1492092860124 Success 2017-04-13 14:14:20 +0000 UTC 83 f1ce6c07547d4b5caa406c5456ed0cff action-invoke-nodejsdefault-1492092860124 Success 2017-04-13 14:14:20 +0000 UTC 51 93b44e940bdc4fb09e1dd0d4d4768db3 action-invoke-nodejsdefault-1492092800101 Success 2017-04-13 14:13:20 +0000 UTC 75

All 22 comments

wsk activation get <activationId> --summary already shows the end time in a human readable format:

$ wsk activation get 7a3c8cf312f04acdba395a74208ed574 --summary
activation result for /[email protected]/robi01 (success at 2017-04-11 14:42:36 +0200 CEST)
{
    "name": "hallo"
}

wsk activation get <activationId>
can show the start time the same way in the first line :

$ wsk activation get 7a3c8cf312f04acdba395a74208ed574
ok: got activation 7a3c8cf312f04acdba395a74208ed574 (started at 2017-04-11 14:42:36 +0200 CEST)
{
    "namespace": "[email protected]",
    "name": "robi01",
    "version": "0.0.1",
    "subject": "[email protected]",
    "activationId": "7a3c8cf312f04acdba395a74208ed574",
    "start": 1491914556836,
    "end": 1491914556891,
    "duration": 55,
    "response": {
        "status": "success",
        "statusCode": 0,
        "success": true,
        "result": {
            "name": "hallo"
        }
    },
    "logs": [],
    "annotations": [
        {
            "key": "limits",
            "value": {
                "logs": 10,
                "memory": 256,
                "timeout": 60000
            }
        },
        {
            "key": "path",
            "value": "[email protected]/robi01"
        }
    ],
    "publish": false
}

Perhaps adding some of this summary information to the activation list output would be useful (i.e. response status, execution start/duration)

$ wsk activation list
can also show a human readable start time for the listed activations :

wsk activation list
activations
2017-04-12 14:49:09 +0200 CEST 84fff57d8fc44bbb917b74ac1bcbe56f action-invoke-nodejsdefault-1492001349145
2017-04-12 14:49:09 +0200 CEST 7c54d0a83968404fbb4e87d7f18585ac action-invoke-nodejsdefault-1492001349145
2017-04-12 14:48:09 +0200 CEST 55a8beb21ee64489a127a94b8be3e32f action-invoke-nodejsdefault-1492001289125
2017-04-12 14:48:09 +0200 CEST fcd08d2dab0744ad86a67dc1af33e07f action-invoke-nodejsdefault-1492001289125
2017-04-12 14:47:09 +0200 CEST 8eb0714ce0a64a70b4a108c2b42ccb88 action-invoke-nodejsdefault-1492001229107
2017-04-12 14:47:09 +0200 CEST db48f360001b4952918ae8648668bc88 action-invoke-nodejsdefault-1492001229107
2017-04-12 14:46:09 +0200 CEST 89b26becaf78421da975c803f5f9d876 action-invoke-nodejsdefault-1492001169077
2017-04-12 14:46:09 +0200 CEST fd24a510da0c472b9ce8d28fb40074bb action-invoke-nodejsdefault-1492001169077
2017-04-12 14:45:09 +0200 CEST b2286bac93274aac95edf2021154e3f8 action-invoke-nodejsdefault-1492001109056
2017-04-12 14:45:09 +0200 CEST c1056822999843af9ef7adc6bab83cc0 action-invoke-nodejsdefault-1492001109056

i would put the extra info on the right (last columns) and preserve existing format where id is first.
there are users who have scripts that process these columns, we shouldn't break them plus if there are other fields, it's better to float on the right.

Here is an output showing also the response statusCode :

$ wsk activation list
StartTime                      ActivationID                     StatusCode Name
2017-04-12 18:26:31 +0200 CEST fe899061278940fdb098136c89abffbe     0      action-invoke-nodejsdefault-1492014390897
2017-04-12 18:26:31 +0200 CEST 4e15745bcb8d4313a9d1256d501ecfbb     0      action-invoke-nodejsdefault-1492014390897
2017-04-12 18:25:31 +0200 CEST 0d6451b4a83e486d846f4776c72fbf08     0      action-invoke-nodejsdefault-1492014330880
2017-04-12 18:25:31 +0200 CEST 71f5208606344ddf85ea6ce635b6b5a9     0      action-invoke-nodejsdefault-1492014330880
2017-04-12 18:24:31 +0200 CEST 74ce04d56e88459db08584007ba7b088     0      action-invoke-nodejsdefault-1492014270857
2017-04-12 18:24:31 +0200 CEST f62020280b1342e483b5fa091cb9367f     0      action-invoke-nodejsdefault-1492014270857
2017-04-12 18:23:31 +0200 CEST ee5f1c29a54c4feea3f20fb91ce1ab33     0      action-invoke-nodejsdefault-1492014210837
2017-04-12 18:23:31 +0200 CEST 19ff5ac2e82e4b6bbbc0172ac44b3d9b     0      action-invoke-nodejsdefault-1492014210837

@rabbah
ok, will rearrange the order of the fields.
Because the action Name is variable in length, the formatting of the last values may be not in a column .

Perhaps also include a duration (in ms) column.. For NLS purposes, "StartTime" -> "Start Time".
@rabbah - what bits of the activation response are needed to convey a good status summary?

  • response.status (i.e. "success", ... others?)
  • response.statusCode (i.e. action exit code ?)
  • response.sucess (i.e. true/false)
  • response.result.statusCode (web action)
  • other??

I would just report success/failure. To some extent this could become quite heavy. See "npm wab" for motivation. I think getting the start time, duration, and success indicator is sufficient.

With the success/failure coming directly from response.status or response.success?

$ wsk activation list
ActivationID                     Name                                      Status  StartTime
dc1f4358bd784544b12f4dd3c3c2b06c action-invoke-nodejsdefault-1492089032779 Success 2017-04-13 15:10:33 +0200 CEST
c23dc9aa62f74245a645f97cdf723792 action-invoke-nodejsdefault-1492089032779 Success 2017-04-13 15:10:33 +0200 CEST
24a2a5f8ed404ad19f61b123e3c71618 action-invoke-nodejsdefault-1492088972769 Success 2017-04-13 15:09:34 +0200 CEST
c186ef20fb074112bd8a45780da26b04 action-invoke-nodejsdefault-1492088972769 Success 2017-04-13 15:09:34 +0200 CEST
3e5ae60ab454449e949efe3936050ff3 action-invoke-nodejsdefault-1492088912749 Success 2017-04-13 15:08:33 +0200 CEST
805554eaa7c542feaf2ba6a8e3589202 action-invoke-nodejsdefault-1492088912749 Success 2017-04-13 15:08:33 +0200 CEST
fabc85e98a1e4e9a978aafc072656425 robi02                                    Failure 2017-04-13 15:07:51 +0200 CEST
b8251675e5d943d78625dfe6ef52d7a3 action-invoke-nodejsdefault-1492088852730 Success 2017-04-13 15:07:33 +0200 CEST

This is looking good! Would be great to see a Duration column after the start time.

Will the Start Time column values always be displayed in the local time zone?

Does the Name column have a max length or will it dynamically extend to the largest action name?

The width of the name column is dynamically the length of the largest entry.

The start time is the local time. UTC is also possible ...

adding duration ...

` $ wsk activation list ActivationID Name Status StartTime Duration d8a139f69c1f48d980326ee88bbdcb29 action-invoke-nodejsdefault-1492092980162 Success 2017-04-13 14:16:20 +0000 UTC 62 b477d80f59ba443ea475c8d4637c0635 action-invoke-nodejsdefault-1492092980162 Success 2017-04-13 14:16:20 +0000 UTC 45 7a0616fb75064e7287c8f96fbf42987c robi02 Failure 2017-04-13 14:16:09 +0000 UTC 3 24b7af4ff85f48028a1bfc6680fd0160 action-invoke-nodejsdefault-1492092920140 Success 2017-04-13 14:15:20 +0000 UTC 83 4e389a2ebb564d49a7ea78756f43e856 action-invoke-nodejsdefault-1492092920140 Success 2017-04-13 14:15:20 +0000 UTC 47 0eea632914434325986b0b5af2f5090c action-invoke-nodejsdefault-1492092860124 Success 2017-04-13 14:14:20 +0000 UTC 83 f1ce6c07547d4b5caa406c5456ed0cff action-invoke-nodejsdefault-1492092860124 Success 2017-04-13 14:14:20 +0000 UTC 51 93b44e940bdc4fb09e1dd0d4d4768db3 action-invoke-nodejsdefault-1492092800101 Success 2017-04-13 14:13:20 +0000 UTC 75

I like it! Minor comments

  • Column header spaces. "ActivationID" -> "Activation ID"; "StartTime" -> "Start Time"
  • Add units to Duration header
  • May just be the way the output is displayed... minor duration value alignment.. not fully right aligned.

note that action names can be up to 256 characters long - should there be a cutoff (after 32 chars, use ... for example)?

Changed formatting to:
Activation ID : 32 characters
Action Name : variable (largest name) (width min: 5 , max: 50) .
If length is > 50 : display first 46 chars + " ..."
Status : Failure or Success
Start Time : e.g. 2017-04-19 14:10:14 +0000 UTC
Duration [ms] : variable width (highest number of digits), right aligned

example 1 :

$ wsk activation list
Activation ID                    Name    Status  Start Time                     Duration [ms]
de718b48af7b466aa2ded594d25c66ed action1 Success 2017-04-19 14:33:49 +0000 UTC   83
976cd0ec780a4d978b4258942e4076b8 action2 Success 2017-04-19 14:33:44 +0000 UTC   56
7637e1b82d8d492198c0433cf9f6215d action2 Success 2017-04-19 14:33:42 +0000 UTC   95
5ce6c88e967547f8aa486c34cd31d442 action3 Success 2017-04-19 14:33:33 +0000 UTC  506
a20804dd4ef8459b923c7efbf6f36b3f action3 Success 2017-04-19 14:33:25 +0000 UTC  554

example 2 (long action names) :

$ wsk activation list
Activation ID                    Name                                               Status  Start Time                     Duration [ms]
56f1ae03da424a75b1e70fa7d73bb419 action-invoke-nodejsdefault-1492611019965          Success 2017-04-19 14:10:20 +0000 UTC     69
eb60f5a9098d4323b32c52d7bed478c7 action-invoke-nodejsdefault-1492611019965          Success 2017-04-19 14:10:20 +0000 UTC     85
1c45cfb7cf374692bdd7f3c934257d73 robi-123456789-123456789-123456789-123456789-1 ... Failure 2017-04-19 14:10:14 +0000 UTC     45
0631ae9384c444ecbe128474fd50b6da action-invoke-nodejsdefault-1492610959946          Success 2017-04-19 14:09:20 +0000 UTC     50
33794bb0ca84470a94987c075c3fec2d action-invoke-nodejsdefault-1492610959946          Success 2017-04-19 14:09:20 +0000 UTC     83
85065f5d849746b9a32abfe09f774082 r2                                                 Success 2017-04-19 14:08:24 +0000 UTC  50048
b9fc32b971524869bd60f7ecc5ab4290 action-invoke-nodejsdefault-1492610899925          Success 2017-04-19 14:08:20 +0000 UTC     69
06ae951fa76f4c40a58d6ff3e4cc9f94 action-invoke-nodejsdefault-1492610899925          Success 2017-04-19 14:08:20 +0000 UTC     42
cbc90527dc04497dbf732482ed5ec1f6 action-invoke-nodejsdefault-1492610839905          Success 2017-04-19 14:07:20 +0000 UTC     73

Looks great! Minor personal preference re: alignment of duration values.. Since these value "grow" to the left the values are right aligned, but not right aligned with the column

Duration [ms]
           83
           56
           95
          506
          554
        50048

awesome!

Aligned duration to the right boundary of the column.

Question:
At the moment Column Headers are in English.
We have prepared NLS support for messages, but not for the column headers of list output.
Do we plan to translate column headers as well ?
If yes, the columns need to handle variable width based on header text width.

Good question. In general, all PII text is externalized, but has not yet been translated.

Yeah, variable column sizes will need a dynamic format string.. example:

fmtString = "%-"+strconv.Itoa(maxActionNameSize)+"s %7s %"+strconv.Itoa(maxApiNameSize+1)+"s  %s\n"

I suggest you deal with that separately. There are several headings that will need to change.

Was this page helpful?
0 / 5 - 0 ratings