@flyteorg/flyteidl 1.16.0 → 2.0.0-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/package.json +6 -9
  2. package/LICENSE +0 -202
  3. package/NOTICE +0 -4
  4. package/README.md +0 -14
  5. package/gen/pb-js/flyteidl.d.ts +0 -28307
  6. package/gen/pb-js/flyteidl.js +0 -66636
  7. package/protos/buf.lock +0 -18
  8. package/protos/buf.yaml +0 -12
  9. package/protos/docs/admin/admin.rst +0 -4623
  10. package/protos/docs/admin/index.rst +0 -13
  11. package/protos/docs/contributing.md +0 -68
  12. package/protos/docs/core/core.rst +0 -3952
  13. package/protos/docs/core/index.rst +0 -15
  14. package/protos/docs/datacatalog/datacatalog.rst +0 -1313
  15. package/protos/docs/datacatalog/index.rst +0 -16
  16. package/protos/docs/event/event.rst +0 -726
  17. package/protos/docs/event/index.rst +0 -27
  18. package/protos/docs/plugins/index.rst +0 -14
  19. package/protos/docs/plugins/plugins.rst +0 -780
  20. package/protos/docs/restructuredtext.tmpl +0 -129
  21. package/protos/docs/service/index.rst +0 -13
  22. package/protos/docs/service/service.rst +0 -543
  23. package/protos/docs/withoutscalar_restructuredtext.tmpl +0 -105
  24. package/protos/docs_index.rst +0 -19
  25. package/protos/flyteidl/admin/agent.proto +0 -309
  26. package/protos/flyteidl/admin/cluster_assignment.proto +0 -11
  27. package/protos/flyteidl/admin/common.proto +0 -337
  28. package/protos/flyteidl/admin/description_entity.proto +0 -95
  29. package/protos/flyteidl/admin/event.proto +0 -70
  30. package/protos/flyteidl/admin/execution.proto +0 -436
  31. package/protos/flyteidl/admin/launch_plan.proto +0 -231
  32. package/protos/flyteidl/admin/matchable_resource.proto +0 -194
  33. package/protos/flyteidl/admin/node_execution.proto +0 -248
  34. package/protos/flyteidl/admin/notification.proto +0 -27
  35. package/protos/flyteidl/admin/project.proto +0 -132
  36. package/protos/flyteidl/admin/project_attributes.proto +0 -69
  37. package/protos/flyteidl/admin/project_domain_attributes.proto +0 -80
  38. package/protos/flyteidl/admin/schedule.proto +0 -43
  39. package/protos/flyteidl/admin/signal.proto +0 -86
  40. package/protos/flyteidl/admin/task.proto +0 -71
  41. package/protos/flyteidl/admin/task_execution.proto +0 -171
  42. package/protos/flyteidl/admin/version.proto +0 -27
  43. package/protos/flyteidl/admin/workflow.proto +0 -92
  44. package/protos/flyteidl/admin/workflow_attributes.proto +0 -89
  45. package/protos/flyteidl/cacheservice/cacheservice.proto +0 -143
  46. package/protos/flyteidl/core/artifact_id.proto +0 -112
  47. package/protos/flyteidl/core/catalog.proto +0 -63
  48. package/protos/flyteidl/core/compiler.proto +0 -64
  49. package/protos/flyteidl/core/condition.proto +0 -63
  50. package/protos/flyteidl/core/dynamic_job.proto +0 -32
  51. package/protos/flyteidl/core/errors.proto +0 -42
  52. package/protos/flyteidl/core/execution.proto +0 -156
  53. package/protos/flyteidl/core/execution_envs.proto +0 -45
  54. package/protos/flyteidl/core/identifier.proto +0 -80
  55. package/protos/flyteidl/core/interface.proto +0 -64
  56. package/protos/flyteidl/core/literals.proto +0 -205
  57. package/protos/flyteidl/core/metrics.proto +0 -50
  58. package/protos/flyteidl/core/security.proto +0 -135
  59. package/protos/flyteidl/core/tasks.proto +0 -392
  60. package/protos/flyteidl/core/types.proto +0 -208
  61. package/protos/flyteidl/core/workflow.proto +0 -361
  62. package/protos/flyteidl/core/workflow_closure.proto +0 -18
  63. package/protos/flyteidl/datacatalog/datacatalog.proto +0 -420
  64. package/protos/flyteidl/event/cloudevents.proto +0 -81
  65. package/protos/flyteidl/event/event.proto +0 -347
  66. package/protos/flyteidl/plugins/array_job.proto +0 -30
  67. package/protos/flyteidl/plugins/common.proto +0 -27
  68. package/protos/flyteidl/plugins/dask.proto +0 -41
  69. package/protos/flyteidl/plugins/kubeflow/common.proto +0 -28
  70. package/protos/flyteidl/plugins/kubeflow/mpi.proto +0 -47
  71. package/protos/flyteidl/plugins/kubeflow/pytorch.proto +0 -53
  72. package/protos/flyteidl/plugins/kubeflow/tensorflow.proto +0 -46
  73. package/protos/flyteidl/plugins/mpi.proto +0 -20
  74. package/protos/flyteidl/plugins/presto.proto +0 -14
  75. package/protos/flyteidl/plugins/pytorch.proto +0 -25
  76. package/protos/flyteidl/plugins/qubole.proto +0 -26
  77. package/protos/flyteidl/plugins/ray.proto +0 -59
  78. package/protos/flyteidl/plugins/spark.proto +0 -42
  79. package/protos/flyteidl/plugins/tensorflow.proto +0 -18
  80. package/protos/flyteidl/plugins/waitable.proto +0 -15
  81. package/protos/flyteidl/service/admin.proto +0 -668
  82. package/protos/flyteidl/service/agent.proto +0 -79
  83. package/protos/flyteidl/service/auth.proto +0 -94
  84. package/protos/flyteidl/service/dataproxy.proto +0 -205
  85. package/protos/flyteidl/service/external_plugin_service.proto +0 -79
  86. package/protos/flyteidl/service/identity.proto +0 -51
  87. package/protos/flyteidl/service/signal.proto +0 -55
@@ -1,726 +0,0 @@
1
- ######################
2
- Protocol Documentation
3
- ######################
4
-
5
-
6
-
7
-
8
- .. _ref_flyteidl/event/event.proto:
9
-
10
- flyteidl/event/event.proto
11
- ==================================================================
12
-
13
-
14
-
15
-
16
-
17
- .. _ref_flyteidl.event.DynamicWorkflowNodeMetadata:
18
-
19
- DynamicWorkflowNodeMetadata
20
- ------------------------------------------------------------------
21
-
22
- For dynamic workflow nodes we send information about the dynamic workflow definition that gets generated.
23
-
24
-
25
-
26
- .. csv-table:: DynamicWorkflowNodeMetadata type fields
27
- :header: "Field", "Type", "Label", "Description"
28
- :widths: auto
29
-
30
- "id", ":ref:`ref_flyteidl.core.Identifier`", "", "id represents the unique identifier of the workflow."
31
- "compiled_workflow", ":ref:`ref_flyteidl.core.CompiledWorkflowClosure`", "", "Represents the compiled representation of the embedded dynamic workflow."
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- .. _ref_flyteidl.event.ExternalResourceInfo:
40
-
41
- ExternalResourceInfo
42
- ------------------------------------------------------------------
43
-
44
- This message contains metadata about external resources produced or used by a specific task execution.
45
-
46
-
47
-
48
- .. csv-table:: ExternalResourceInfo type fields
49
- :header: "Field", "Type", "Label", "Description"
50
- :widths: auto
51
-
52
- "external_id", ":ref:`ref_string`", "", "Identifier for an external resource created by this task execution, for example Qubole query ID or presto query ids."
53
- "index", ":ref:`ref_uint32`", "", "A unique index for the external resource with respect to all external resources for this task. Although the identifier may change between task reporting events or retries, this will remain the same to enable aggregating information from multiple reports."
54
- "retry_attempt", ":ref:`ref_uint32`", "", "Retry attempt number for this external resource, ie., 2 for the second attempt"
55
- "phase", ":ref:`ref_flyteidl.core.TaskExecution.Phase`", "", "Phase associated with the external resource"
56
- "cache_status", ":ref:`ref_flyteidl.core.CatalogCacheStatus`", "", "Captures the status of caching for this external resource execution."
57
- "logs", ":ref:`ref_flyteidl.core.TaskLog`", "repeated", "log information for the external resource execution"
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
- .. _ref_flyteidl.event.NodeExecutionEvent:
66
-
67
- NodeExecutionEvent
68
- ------------------------------------------------------------------
69
-
70
-
71
-
72
-
73
-
74
- .. csv-table:: NodeExecutionEvent type fields
75
- :header: "Field", "Type", "Label", "Description"
76
- :widths: auto
77
-
78
- "id", ":ref:`ref_flyteidl.core.NodeExecutionIdentifier`", "", "Unique identifier for this node execution"
79
- "producer_id", ":ref:`ref_string`", "", "the id of the originator (Propeller) of the event"
80
- "phase", ":ref:`ref_flyteidl.core.NodeExecution.Phase`", "", ""
81
- "occurred_at", ":ref:`ref_google.protobuf.Timestamp`", "", "This timestamp represents when the original event occurred, it is generated by the executor of the node."
82
- "input_uri", ":ref:`ref_string`", "", ""
83
- "output_uri", ":ref:`ref_string`", "", "URL to the output of the execution, it encodes all the information including Cloud source provider. ie., s3://..."
84
- "error", ":ref:`ref_flyteidl.core.ExecutionError`", "", "Error information for the execution"
85
- "output_data", ":ref:`ref_flyteidl.core.LiteralMap`", "", "Raw output data produced by this node execution."
86
- "workflow_node_metadata", ":ref:`ref_flyteidl.event.WorkflowNodeMetadata`", "", ""
87
- "task_node_metadata", ":ref:`ref_flyteidl.event.TaskNodeMetadata`", "", ""
88
- "parent_task_metadata", ":ref:`ref_flyteidl.event.ParentTaskExecutionMetadata`", "", "[To be deprecated] Specifies which task (if any) launched this node."
89
- "parent_node_metadata", ":ref:`ref_flyteidl.event.ParentNodeExecutionMetadata`", "", "Specifies the parent node of the current node execution. Node executions at level zero will not have a parent node."
90
- "retry_group", ":ref:`ref_string`", "", "Retry group to indicate grouping of nodes by retries"
91
- "spec_node_id", ":ref:`ref_string`", "", "Identifier of the node in the original workflow/graph This maps to value of WorkflowTemplate.nodes[X].id"
92
- "node_name", ":ref:`ref_string`", "", "Friendly readable name for the node"
93
- "event_version", ":ref:`ref_int32`", "", ""
94
- "is_parent", ":ref:`ref_bool`", "", "Whether this node launched a subworkflow."
95
- "is_dynamic", ":ref:`ref_bool`", "", "Whether this node yielded a dynamic workflow."
96
- "deck_uri", ":ref:`ref_string`", "", "String location uniquely identifying where the deck HTML file is NativeUrl specifies the url in the format of the configured storage provider (e.g. s3://my-bucket/randomstring/suffix.tar)"
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
- .. _ref_flyteidl.event.ParentNodeExecutionMetadata:
105
-
106
- ParentNodeExecutionMetadata
107
- ------------------------------------------------------------------
108
-
109
-
110
-
111
-
112
-
113
- .. csv-table:: ParentNodeExecutionMetadata type fields
114
- :header: "Field", "Type", "Label", "Description"
115
- :widths: auto
116
-
117
- "node_id", ":ref:`ref_string`", "", "Unique identifier of the parent node id within the execution This is value of core.NodeExecutionIdentifier.node_id of the parent node"
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
- .. _ref_flyteidl.event.ParentTaskExecutionMetadata:
126
-
127
- ParentTaskExecutionMetadata
128
- ------------------------------------------------------------------
129
-
130
-
131
-
132
-
133
-
134
- .. csv-table:: ParentTaskExecutionMetadata type fields
135
- :header: "Field", "Type", "Label", "Description"
136
- :widths: auto
137
-
138
- "id", ":ref:`ref_flyteidl.core.TaskExecutionIdentifier`", "", ""
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
- .. _ref_flyteidl.event.ResourcePoolInfo:
147
-
148
- ResourcePoolInfo
149
- ------------------------------------------------------------------
150
-
151
- This message holds task execution metadata specific to resource allocation used to manage concurrent
152
- executions for a project namespace.
153
-
154
-
155
-
156
- .. csv-table:: ResourcePoolInfo type fields
157
- :header: "Field", "Type", "Label", "Description"
158
- :widths: auto
159
-
160
- "allocation_token", ":ref:`ref_string`", "", "Unique resource ID used to identify this execution when allocating a token."
161
- "namespace", ":ref:`ref_string`", "", "Namespace under which this task execution requested an allocation token."
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
- .. _ref_flyteidl.event.TaskExecutionEvent:
170
-
171
- TaskExecutionEvent
172
- ------------------------------------------------------------------
173
-
174
- Plugin specific execution event information. For tasks like Python, Hive, Spark, DynamicJob.
175
-
176
-
177
-
178
- .. csv-table:: TaskExecutionEvent type fields
179
- :header: "Field", "Type", "Label", "Description"
180
- :widths: auto
181
-
182
- "task_id", ":ref:`ref_flyteidl.core.Identifier`", "", "ID of the task. In combination with the retryAttempt this will indicate the task execution uniquely for a given parent node execution."
183
- "parent_node_execution_id", ":ref:`ref_flyteidl.core.NodeExecutionIdentifier`", "", "A task execution is always kicked off by a node execution, the event consumer will use the parent_id to relate the task to it's parent node execution"
184
- "retry_attempt", ":ref:`ref_uint32`", "", "retry attempt number for this task, ie., 2 for the second attempt"
185
- "phase", ":ref:`ref_flyteidl.core.TaskExecution.Phase`", "", "Phase associated with the event"
186
- "producer_id", ":ref:`ref_string`", "", "id of the process that sent this event, mainly for trace debugging"
187
- "logs", ":ref:`ref_flyteidl.core.TaskLog`", "repeated", "log information for the task execution"
188
- "occurred_at", ":ref:`ref_google.protobuf.Timestamp`", "", "This timestamp represents when the original event occurred, it is generated by the executor of the task."
189
- "input_uri", ":ref:`ref_string`", "", "URI of the input file, it encodes all the information including Cloud source provider. ie., s3://..."
190
- "output_uri", ":ref:`ref_string`", "", "URI to the output of the execution, it will be in a format that encodes all the information including Cloud source provider. ie., s3://..."
191
- "error", ":ref:`ref_flyteidl.core.ExecutionError`", "", "Error information for the execution"
192
- "output_data", ":ref:`ref_flyteidl.core.LiteralMap`", "", "Raw output data produced by this task execution."
193
- "custom_info", ":ref:`ref_google.protobuf.Struct`", "", "Custom data that the task plugin sends back. This is extensible to allow various plugins in the system."
194
- "phase_version", ":ref:`ref_uint32`", "", "Some phases, like RUNNING, can send multiple events with changed metadata (new logs, additional custom_info, etc) that should be recorded regardless of the lack of phase change. The version field should be incremented when metadata changes across the duration of an individual phase."
195
- "reason", ":ref:`ref_string`", "", "An optional explanation for the phase transition."
196
- "task_type", ":ref:`ref_string`", "", "A predefined yet extensible Task type identifier. If the task definition is already registered in flyte admin this type will be identical, but not all task executions necessarily use pre-registered definitions and this type is useful to render the task in the UI, filter task executions, etc."
197
- "metadata", ":ref:`ref_flyteidl.event.TaskExecutionMetadata`", "", "Metadata around how a task was executed."
198
- "event_version", ":ref:`ref_int32`", "", "The event version is used to indicate versioned changes in how data is reported using this proto message. For example, event_verison > 0 means that maps tasks report logs using the TaskExecutionMetadata ExternalResourceInfo fields for each subtask rather than the TaskLog in this message."
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
- .. _ref_flyteidl.event.TaskExecutionMetadata:
207
-
208
- TaskExecutionMetadata
209
- ------------------------------------------------------------------
210
-
211
- Holds metadata around how a task was executed.
212
- As a task transitions across event phases during execution some attributes, such its generated name, generated external resources,
213
- and more may grow in size but not change necessarily based on the phase transition that sparked the event update.
214
- Metadata is a container for these attributes across the task execution lifecycle.
215
-
216
-
217
-
218
- .. csv-table:: TaskExecutionMetadata type fields
219
- :header: "Field", "Type", "Label", "Description"
220
- :widths: auto
221
-
222
- "generated_name", ":ref:`ref_string`", "", "Unique, generated name for this task execution used by the backend."
223
- "external_resources", ":ref:`ref_flyteidl.event.ExternalResourceInfo`", "repeated", "Additional data on external resources on other back-ends or platforms (e.g. Hive, Qubole, etc) launched by this task execution."
224
- "resource_pool_info", ":ref:`ref_flyteidl.event.ResourcePoolInfo`", "repeated", "Includes additional data on concurrent resource management used during execution.. This is a repeated field because a plugin can request multiple resource allocations during execution."
225
- "plugin_identifier", ":ref:`ref_string`", "", "The identifier of the plugin used to execute this task."
226
- "instance_class", ":ref:`ref_flyteidl.event.TaskExecutionMetadata.InstanceClass`", "", ""
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
- .. _ref_flyteidl.event.TaskNodeMetadata:
235
-
236
- TaskNodeMetadata
237
- ------------------------------------------------------------------
238
-
239
-
240
-
241
-
242
-
243
- .. csv-table:: TaskNodeMetadata type fields
244
- :header: "Field", "Type", "Label", "Description"
245
- :widths: auto
246
-
247
- "cache_status", ":ref:`ref_flyteidl.core.CatalogCacheStatus`", "", "Captures the status of caching for this execution."
248
- "catalog_key", ":ref:`ref_flyteidl.core.CatalogMetadata`", "", "This structure carries the catalog artifact information"
249
- "reservation_status", ":ref:`ref_flyteidl.core.CatalogReservation.Status`", "", "Captures the status of cache reservations for this execution."
250
- "checkpoint_uri", ":ref:`ref_string`", "", "The latest checkpoint location"
251
- "dynamic_workflow", ":ref:`ref_flyteidl.event.DynamicWorkflowNodeMetadata`", "", "In the case this task launched a dynamic workflow we capture its structure here."
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
- .. _ref_flyteidl.event.WorkflowExecutionEvent:
260
-
261
- WorkflowExecutionEvent
262
- ------------------------------------------------------------------
263
-
264
-
265
-
266
-
267
-
268
- .. csv-table:: WorkflowExecutionEvent type fields
269
- :header: "Field", "Type", "Label", "Description"
270
- :widths: auto
271
-
272
- "execution_id", ":ref:`ref_flyteidl.core.WorkflowExecutionIdentifier`", "", "Workflow execution id"
273
- "producer_id", ":ref:`ref_string`", "", "the id of the originator (Propeller) of the event"
274
- "phase", ":ref:`ref_flyteidl.core.WorkflowExecution.Phase`", "", ""
275
- "occurred_at", ":ref:`ref_google.protobuf.Timestamp`", "", "This timestamp represents when the original event occurred, it is generated by the executor of the workflow."
276
- "output_uri", ":ref:`ref_string`", "", "URL to the output of the execution, it encodes all the information including Cloud source provider. ie., s3://..."
277
- "error", ":ref:`ref_flyteidl.core.ExecutionError`", "", "Error information for the execution"
278
- "output_data", ":ref:`ref_flyteidl.core.LiteralMap`", "", "Raw output data produced by this workflow execution."
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
- .. _ref_flyteidl.event.WorkflowNodeMetadata:
287
-
288
- WorkflowNodeMetadata
289
- ------------------------------------------------------------------
290
-
291
- For Workflow Nodes we need to send information about the workflow that's launched
292
-
293
-
294
-
295
- .. csv-table:: WorkflowNodeMetadata type fields
296
- :header: "Field", "Type", "Label", "Description"
297
- :widths: auto
298
-
299
- "execution_id", ":ref:`ref_flyteidl.core.WorkflowExecutionIdentifier`", "", ""
300
-
301
-
302
-
303
-
304
-
305
-
306
- ..
307
- end messages
308
-
309
-
310
-
311
- .. _ref_flyteidl.event.TaskExecutionMetadata.InstanceClass:
312
-
313
- TaskExecutionMetadata.InstanceClass
314
- ------------------------------------------------------------------
315
-
316
- Includes the broad category of machine used for this specific task execution.
317
-
318
- .. csv-table:: Enum TaskExecutionMetadata.InstanceClass values
319
- :header: "Name", "Number", "Description"
320
- :widths: auto
321
-
322
- "DEFAULT", "0", "The default instance class configured for the flyte application platform."
323
- "INTERRUPTIBLE", "1", "The instance class configured for interruptible tasks."
324
-
325
-
326
- ..
327
- end enums
328
-
329
-
330
- ..
331
- end HasExtensions
332
-
333
-
334
- ..
335
- end services
336
-
337
-
338
-
339
-
340
- .. _ref_google/protobuf/timestamp.proto:
341
-
342
- google/protobuf/timestamp.proto
343
- ==================================================================
344
-
345
-
346
-
347
-
348
-
349
- .. _ref_google.protobuf.Timestamp:
350
-
351
- Timestamp
352
- ------------------------------------------------------------------
353
-
354
- A Timestamp represents a point in time independent of any time zone or local
355
- calendar, encoded as a count of seconds and fractions of seconds at
356
- nanosecond resolution. The count is relative to an epoch at UTC midnight on
357
- January 1, 1970, in the proleptic Gregorian calendar which extends the
358
- Gregorian calendar backwards to year one.
359
-
360
- All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
361
- second table is needed for interpretation, using a [24-hour linear
362
- smear](https://developers.google.com/time/smear).
363
-
364
- The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
365
- restricting to that range, we ensure that we can convert to and from [RFC
366
- 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
367
-
368
- # Examples
369
-
370
- Example 1: Compute Timestamp from POSIX `time()`.
371
-
372
- Timestamp timestamp;
373
- timestamp.set_seconds(time(NULL));
374
- timestamp.set_nanos(0);
375
-
376
- Example 2: Compute Timestamp from POSIX `gettimeofday()`.
377
-
378
- struct timeval tv;
379
- gettimeofday(&tv, NULL);
380
-
381
- Timestamp timestamp;
382
- timestamp.set_seconds(tv.tv_sec);
383
- timestamp.set_nanos(tv.tv_usec * 1000);
384
-
385
- Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
386
-
387
- FILETIME ft;
388
- GetSystemTimeAsFileTime(&ft);
389
- UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
390
-
391
- // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
392
- // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
393
- Timestamp timestamp;
394
- timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
395
- timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
396
-
397
- Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
398
-
399
- long millis = System.currentTimeMillis();
400
-
401
- Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
402
- .setNanos((int) ((millis % 1000) * 1000000)).build();
403
-
404
- Example 5: Compute Timestamp from Java `Instant.now()`.
405
-
406
- Instant now = Instant.now();
407
-
408
- Timestamp timestamp =
409
- Timestamp.newBuilder().setSeconds(now.getEpochSecond())
410
- .setNanos(now.getNano()).build();
411
-
412
- Example 6: Compute Timestamp from current time in Python.
413
-
414
- timestamp = Timestamp()
415
- timestamp.GetCurrentTime()
416
-
417
- # JSON Mapping
418
-
419
- In JSON format, the Timestamp type is encoded as a string in the
420
- [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
421
- format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
422
- where {year} is always expressed using four digits while {month}, {day},
423
- {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
424
- seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
425
- are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
426
- is required. A proto3 JSON serializer should always use UTC (as indicated by
427
- "Z") when printing the Timestamp type and a proto3 JSON parser should be
428
- able to accept both UTC and other timezones (as indicated by an offset).
429
-
430
- For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
431
- 01:30 UTC on January 15, 2017.
432
-
433
- In JavaScript, one can convert a Date object to this format using the
434
- standard
435
- [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
436
- method. In Python, a standard `datetime.datetime` object can be converted
437
- to this format using
438
- [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
439
- the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
440
- the Joda Time's [`ISODateTimeFormat.dateTime()`](
441
- http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
442
- ) to obtain a formatter capable of generating timestamps in this format.
443
-
444
-
445
-
446
- .. csv-table:: Timestamp type fields
447
- :header: "Field", "Type", "Label", "Description"
448
- :widths: auto
449
-
450
- "seconds", ":ref:`ref_int64`", "", "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."
451
- "nanos", ":ref:`ref_int32`", "", "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive."
452
-
453
-
454
-
455
-
456
-
457
-
458
- ..
459
- end messages
460
-
461
-
462
- ..
463
- end enums
464
-
465
-
466
- ..
467
- end HasExtensions
468
-
469
-
470
- ..
471
- end services
472
-
473
-
474
-
475
-
476
- .. _ref_google/protobuf/duration.proto:
477
-
478
- google/protobuf/duration.proto
479
- ==================================================================
480
-
481
-
482
-
483
-
484
-
485
- .. _ref_google.protobuf.Duration:
486
-
487
- Duration
488
- ------------------------------------------------------------------
489
-
490
- A Duration represents a signed, fixed-length span of time represented
491
- as a count of seconds and fractions of seconds at nanosecond
492
- resolution. It is independent of any calendar and concepts like "day"
493
- or "month". It is related to Timestamp in that the difference between
494
- two Timestamp values is a Duration and it can be added or subtracted
495
- from a Timestamp. Range is approximately +-10,000 years.
496
-
497
- # Examples
498
-
499
- Example 1: Compute Duration from two Timestamps in pseudo code.
500
-
501
- Timestamp start = ...;
502
- Timestamp end = ...;
503
- Duration duration = ...;
504
-
505
- duration.seconds = end.seconds - start.seconds;
506
- duration.nanos = end.nanos - start.nanos;
507
-
508
- if (duration.seconds < 0 && duration.nanos > 0) {
509
- duration.seconds += 1;
510
- duration.nanos -= 1000000000;
511
- } else if (duration.seconds > 0 && duration.nanos < 0) {
512
- duration.seconds -= 1;
513
- duration.nanos += 1000000000;
514
- }
515
-
516
- Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
517
-
518
- Timestamp start = ...;
519
- Duration duration = ...;
520
- Timestamp end = ...;
521
-
522
- end.seconds = start.seconds + duration.seconds;
523
- end.nanos = start.nanos + duration.nanos;
524
-
525
- if (end.nanos < 0) {
526
- end.seconds -= 1;
527
- end.nanos += 1000000000;
528
- } else if (end.nanos >= 1000000000) {
529
- end.seconds += 1;
530
- end.nanos -= 1000000000;
531
- }
532
-
533
- Example 3: Compute Duration from datetime.timedelta in Python.
534
-
535
- td = datetime.timedelta(days=3, minutes=10)
536
- duration = Duration()
537
- duration.FromTimedelta(td)
538
-
539
- # JSON Mapping
540
-
541
- In JSON format, the Duration type is encoded as a string rather than an
542
- object, where the string ends in the suffix "s" (indicating seconds) and
543
- is preceded by the number of seconds, with nanoseconds expressed as
544
- fractional seconds. For example, 3 seconds with 0 nanoseconds should be
545
- encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
546
- be expressed in JSON format as "3.000000001s", and 3 seconds and 1
547
- microsecond should be expressed in JSON format as "3.000001s".
548
-
549
-
550
-
551
- .. csv-table:: Duration type fields
552
- :header: "Field", "Type", "Label", "Description"
553
- :widths: auto
554
-
555
- "seconds", ":ref:`ref_int64`", "", "Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years"
556
- "nanos", ":ref:`ref_int32`", "", "Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 `seconds` field and a positive or negative `nanos` field. For durations of one second or more, a non-zero value for the `nanos` field must be of the same sign as the `seconds` field. Must be from -999,999,999 to +999,999,999 inclusive."
557
-
558
-
559
-
560
-
561
-
562
-
563
- ..
564
- end messages
565
-
566
-
567
- ..
568
- end enums
569
-
570
-
571
- ..
572
- end HasExtensions
573
-
574
-
575
- ..
576
- end services
577
-
578
-
579
-
580
-
581
- .. _ref_google/protobuf/struct.proto:
582
-
583
- google/protobuf/struct.proto
584
- ==================================================================
585
-
586
-
587
-
588
-
589
-
590
- .. _ref_google.protobuf.ListValue:
591
-
592
- ListValue
593
- ------------------------------------------------------------------
594
-
595
- `ListValue` is a wrapper around a repeated field of values.
596
-
597
- The JSON representation for `ListValue` is JSON array.
598
-
599
-
600
-
601
- .. csv-table:: ListValue type fields
602
- :header: "Field", "Type", "Label", "Description"
603
- :widths: auto
604
-
605
- "values", ":ref:`ref_google.protobuf.Value`", "repeated", "Repeated field of dynamically typed values."
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
- .. _ref_google.protobuf.Struct:
614
-
615
- Struct
616
- ------------------------------------------------------------------
617
-
618
- `Struct` represents a structured data value, consisting of fields
619
- which map to dynamically typed values. In some languages, `Struct`
620
- might be supported by a native representation. For example, in
621
- scripting languages like JS a struct is represented as an
622
- object. The details of that representation are described together
623
- with the proto support for the language.
624
-
625
- The JSON representation for `Struct` is JSON object.
626
-
627
-
628
-
629
- .. csv-table:: Struct type fields
630
- :header: "Field", "Type", "Label", "Description"
631
- :widths: auto
632
-
633
- "fields", ":ref:`ref_google.protobuf.Struct.FieldsEntry`", "repeated", "Unordered map of dynamically typed values."
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
- .. _ref_google.protobuf.Struct.FieldsEntry:
642
-
643
- Struct.FieldsEntry
644
- ------------------------------------------------------------------
645
-
646
-
647
-
648
-
649
-
650
- .. csv-table:: Struct.FieldsEntry type fields
651
- :header: "Field", "Type", "Label", "Description"
652
- :widths: auto
653
-
654
- "key", ":ref:`ref_string`", "", ""
655
- "value", ":ref:`ref_google.protobuf.Value`", "", ""
656
-
657
-
658
-
659
-
660
-
661
-
662
-
663
- .. _ref_google.protobuf.Value:
664
-
665
- Value
666
- ------------------------------------------------------------------
667
-
668
- `Value` represents a dynamically typed value which can be either
669
- null, a number, a string, a boolean, a recursive struct value, or a
670
- list of values. A producer of value is expected to set one of these
671
- variants. Absence of any variant indicates an error.
672
-
673
- The JSON representation for `Value` is JSON value.
674
-
675
-
676
-
677
- .. csv-table:: Value type fields
678
- :header: "Field", "Type", "Label", "Description"
679
- :widths: auto
680
-
681
- "null_value", ":ref:`ref_google.protobuf.NullValue`", "", "Represents a null value."
682
- "number_value", ":ref:`ref_double`", "", "Represents a double value."
683
- "string_value", ":ref:`ref_string`", "", "Represents a string value."
684
- "bool_value", ":ref:`ref_bool`", "", "Represents a boolean value."
685
- "struct_value", ":ref:`ref_google.protobuf.Struct`", "", "Represents a structured value."
686
- "list_value", ":ref:`ref_google.protobuf.ListValue`", "", "Represents a repeated `Value`."
687
-
688
-
689
-
690
-
691
-
692
-
693
- ..
694
- end messages
695
-
696
-
697
-
698
- .. _ref_google.protobuf.NullValue:
699
-
700
- NullValue
701
- ------------------------------------------------------------------
702
-
703
- `NullValue` is a singleton enumeration to represent the null value for the
704
- `Value` type union.
705
-
706
- The JSON representation for `NullValue` is JSON `null`.
707
-
708
- .. csv-table:: Enum NullValue values
709
- :header: "Name", "Number", "Description"
710
- :widths: auto
711
-
712
- "NULL_VALUE", "0", "Null value."
713
-
714
-
715
- ..
716
- end enums
717
-
718
-
719
- ..
720
- end HasExtensions
721
-
722
-
723
- ..
724
- end services
725
-
726
-