Class: Zernio::WorkflowExecutionEvent

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/workflow_execution_event.rb

Overview

One entry in a workflow execution's timeline. Emitted by the executor on every node visit and lifecycle transition, surfaced by GET /v1/workflows/{workflowId}/executions/ {executionId}/events for run inspection in the Runs UI.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WorkflowExecutionEvent

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 121

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WorkflowExecutionEvent` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WorkflowExecutionEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'action')
    self.action = attributes[:'action']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'node_id')
    self.node_id = attributes[:'node_id']
  end

  if attributes.key?(:'node_type')
    self.node_type = attributes[:'node_type']
  end

  if attributes.key?(:'source_handle')
    self.source_handle = attributes[:'source_handle']
  end

  if attributes.key?(:'duration_ms')
    self.duration_ms = attributes[:'duration_ms']
  end

  if attributes.key?(:'error_message')
    self.error_message = attributes[:'error_message']
  end

  if attributes.key?(:'meta')
    if (value = attributes[:'meta']).is_a?(Hash)
      self.meta = value
    end
  end

  if attributes.key?(:'at')
    self.at = attributes[:'at']
  end
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



19
20
21
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 19

def action
  @action
end

#atObject

Event timestamp (UTC)



42
43
44
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 42

def at
  @at
end

#duration_msObject

Node run time; present on node_completed and node_failed



33
34
35
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 33

def duration_ms
  @duration_ms
end

#error_messageObject

Failure detail; present on node_failed and execution_exited



36
37
38
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 36

def error_message
  @error_message
end

#metaObject

Per-node-type payload. Shape varies — see WorkflowNode type. Examples: send_message{ messageType, text, recipient }, webhook{ url, method, statusCode, responseTimeMs, responsePreview }, ai{ model, provider, inputTokens, outputTokens, responsePreview }, condition{ matchedHandle, rulesEvaluated }, a_b_split{ percentage, chosen }.



39
40
41
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 39

def meta
  @meta
end

#node_idObject

Present on node_* events



24
25
26
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 24

def node_id
  @node_id
end

#node_typeObject

Present on node_* events



27
28
29
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 27

def node_type
  @node_type
end

#source_handleObject

The edge handle the executor followed out of this node (see WorkflowEdge.sourceHandle)



30
31
32
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 30

def source_handle
  @source_handle
end

#statusObject

Returns the value of attribute status.



21
22
23
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 21

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



82
83
84
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 82

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



87
88
89
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 87

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 67

def self.attribute_map
  {
    :'action' => :'action',
    :'status' => :'status',
    :'node_id' => :'nodeId',
    :'node_type' => :'nodeType',
    :'source_handle' => :'sourceHandle',
    :'duration_ms' => :'durationMs',
    :'error_message' => :'errorMessage',
    :'meta' => :'meta',
    :'at' => :'at'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 244

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 107

def self.openapi_nullable
  Set.new([
    :'status',
    :'node_id',
    :'node_type',
    :'source_handle',
    :'duration_ms',
    :'error_message',
    :'meta',
  ])
end

.openapi_typesObject

Attribute type mapping.



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 92

def self.openapi_types
  {
    :'action' => :'String',
    :'status' => :'String',
    :'node_id' => :'String',
    :'node_type' => :'String',
    :'source_handle' => :'String',
    :'duration_ms' => :'Integer',
    :'error_message' => :'String',
    :'meta' => :'Hash<String, Object>',
    :'at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 215

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      action == o.action &&
      status == o.status &&
      node_id == o.node_id &&
      node_type == o.node_type &&
      source_handle == o.source_handle &&
      duration_ms == o.duration_ms &&
      error_message == o.error_message &&
      meta == o.meta &&
      at == o.at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


231
232
233
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 231

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



237
238
239
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 237

def hash
  [action, status, node_id, node_type, source_handle, duration_ms, error_message, meta, at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



176
177
178
179
180
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 176

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 266

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



184
185
186
187
188
189
190
191
# File 'lib/zernio-sdk/models/workflow_execution_event.rb', line 184

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  action_validator = EnumAttributeValidator.new('String', ["execution_started", "execution_completed", "execution_exited", "execution_paused", "execution_resumed", "node_started", "node_completed", "node_failed", "node_skipped"])
  return false unless action_validator.valid?(@action)
  status_validator = EnumAttributeValidator.new('String', ["success", "failed", "pending"])
  return false unless status_validator.valid?(@status)
  true
end