temporalio 0.3.0 → 0.4.0

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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +503 -395
  3. data/Gemfile +4 -0
  4. data/README.md +183 -10
  5. data/Rakefile +1 -1
  6. data/ext/Cargo.toml +1 -0
  7. data/lib/temporalio/activity/context.rb +13 -0
  8. data/lib/temporalio/activity/definition.rb +22 -5
  9. data/lib/temporalio/activity/info.rb +3 -0
  10. data/lib/temporalio/api/batch/v1/message.rb +6 -1
  11. data/lib/temporalio/api/command/v1/message.rb +1 -1
  12. data/lib/temporalio/api/common/v1/message.rb +2 -1
  13. data/lib/temporalio/api/deployment/v1/message.rb +38 -0
  14. data/lib/temporalio/api/enums/v1/batch_operation.rb +1 -1
  15. data/lib/temporalio/api/enums/v1/common.rb +1 -1
  16. data/lib/temporalio/api/enums/v1/deployment.rb +23 -0
  17. data/lib/temporalio/api/enums/v1/event_type.rb +1 -1
  18. data/lib/temporalio/api/enums/v1/failed_cause.rb +1 -1
  19. data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
  20. data/lib/temporalio/api/enums/v1/reset.rb +1 -1
  21. data/lib/temporalio/api/enums/v1/workflow.rb +2 -1
  22. data/lib/temporalio/api/errordetails/v1/message.rb +3 -1
  23. data/lib/temporalio/api/failure/v1/message.rb +3 -1
  24. data/lib/temporalio/api/history/v1/message.rb +3 -1
  25. data/lib/temporalio/api/nexus/v1/message.rb +2 -1
  26. data/lib/temporalio/api/payload_visitor.rb +75 -7
  27. data/lib/temporalio/api/query/v1/message.rb +2 -1
  28. data/lib/temporalio/api/taskqueue/v1/message.rb +4 -1
  29. data/lib/temporalio/api/workflow/v1/message.rb +9 -1
  30. data/lib/temporalio/api/workflowservice/v1/request_response.rb +40 -11
  31. data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
  32. data/lib/temporalio/api.rb +1 -0
  33. data/lib/temporalio/client/connection/workflow_service.rb +238 -28
  34. data/lib/temporalio/client/interceptor.rb +39 -0
  35. data/lib/temporalio/client/schedule.rb +25 -1
  36. data/lib/temporalio/client/with_start_workflow_operation.rb +115 -0
  37. data/lib/temporalio/client/workflow_execution.rb +19 -0
  38. data/lib/temporalio/client/workflow_handle.rb +3 -3
  39. data/lib/temporalio/client.rb +125 -2
  40. data/lib/temporalio/contrib/open_telemetry.rb +470 -0
  41. data/lib/temporalio/error.rb +1 -0
  42. data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +1 -1
  43. data/lib/temporalio/internal/bridge/api/common/common.rb +2 -1
  44. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +1 -1
  45. data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +1 -1
  46. data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +2 -1
  47. data/lib/temporalio/internal/bridge/runtime.rb +3 -0
  48. data/lib/temporalio/internal/bridge/testing.rb +3 -0
  49. data/lib/temporalio/internal/client/implementation.rb +232 -10
  50. data/lib/temporalio/internal/proto_utils.rb +34 -2
  51. data/lib/temporalio/internal/worker/activity_worker.rb +20 -8
  52. data/lib/temporalio/internal/worker/multi_runner.rb +2 -2
  53. data/lib/temporalio/internal/worker/workflow_instance/context.rb +57 -3
  54. data/lib/temporalio/internal/worker/workflow_instance/details.rb +4 -2
  55. data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +11 -26
  56. data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +22 -2
  57. data/lib/temporalio/internal/worker/workflow_instance.rb +76 -32
  58. data/lib/temporalio/internal/worker/workflow_worker.rb +62 -19
  59. data/lib/temporalio/runtime/metric_buffer.rb +94 -0
  60. data/lib/temporalio/runtime.rb +48 -10
  61. data/lib/temporalio/search_attributes.rb +13 -0
  62. data/lib/temporalio/testing/activity_environment.rb +42 -14
  63. data/lib/temporalio/testing/workflow_environment.rb +26 -3
  64. data/lib/temporalio/version.rb +1 -1
  65. data/lib/temporalio/worker/interceptor.rb +3 -0
  66. data/lib/temporalio/worker/thread_pool.rb +5 -5
  67. data/lib/temporalio/worker/tuner.rb +38 -0
  68. data/lib/temporalio/worker/workflow_executor/thread_pool.rb +13 -8
  69. data/lib/temporalio/worker/workflow_executor.rb +1 -1
  70. data/lib/temporalio/worker/workflow_replayer.rb +350 -0
  71. data/lib/temporalio/worker.rb +58 -52
  72. data/lib/temporalio/workflow/definition.rb +40 -8
  73. data/lib/temporalio/workflow/future.rb +2 -2
  74. data/lib/temporalio/workflow/info.rb +22 -0
  75. data/lib/temporalio/workflow.rb +60 -8
  76. data/lib/temporalio/workflow_history.rb +26 -1
  77. data/temporalio.gemspec +2 -1
  78. metadata +26 -5
@@ -841,6 +841,201 @@ module Temporalio
841
841
  )
842
842
  end
843
843
 
844
+ # Calls WorkflowService.DescribeDeployment API call.
845
+ #
846
+ # @param request [Temporalio::Api::WorkflowService::V1::DescribeDeploymentRequest] API request.
847
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
848
+ # @return [Temporalio::Api::WorkflowService::V1::DescribeDeploymentResponse] API response.
849
+ def describe_deployment(request, rpc_options: nil)
850
+ invoke_rpc(
851
+ rpc: 'describe_deployment',
852
+ request_class: Temporalio::Api::WorkflowService::V1::DescribeDeploymentRequest,
853
+ response_class: Temporalio::Api::WorkflowService::V1::DescribeDeploymentResponse,
854
+ request:,
855
+ rpc_options:
856
+ )
857
+ end
858
+
859
+ # Calls WorkflowService.DescribeWorkerDeploymentVersion API call.
860
+ #
861
+ # @param request [Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentVersionRequest] API request.
862
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
863
+ # @return [Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentVersionResponse] API response.
864
+ def describe_worker_deployment_version(request, rpc_options: nil)
865
+ invoke_rpc(
866
+ rpc: 'describe_worker_deployment_version',
867
+ request_class: Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentVersionRequest,
868
+ response_class: Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentVersionResponse,
869
+ request:,
870
+ rpc_options:
871
+ )
872
+ end
873
+
874
+ # Calls WorkflowService.ListDeployments API call.
875
+ #
876
+ # @param request [Temporalio::Api::WorkflowService::V1::ListDeploymentsRequest] API request.
877
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
878
+ # @return [Temporalio::Api::WorkflowService::V1::ListDeploymentsResponse] API response.
879
+ def list_deployments(request, rpc_options: nil)
880
+ invoke_rpc(
881
+ rpc: 'list_deployments',
882
+ request_class: Temporalio::Api::WorkflowService::V1::ListDeploymentsRequest,
883
+ response_class: Temporalio::Api::WorkflowService::V1::ListDeploymentsResponse,
884
+ request:,
885
+ rpc_options:
886
+ )
887
+ end
888
+
889
+ # Calls WorkflowService.GetDeploymentReachability API call.
890
+ #
891
+ # @param request [Temporalio::Api::WorkflowService::V1::GetDeploymentReachabilityRequest] API request.
892
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
893
+ # @return [Temporalio::Api::WorkflowService::V1::GetDeploymentReachabilityResponse] API response.
894
+ def get_deployment_reachability(request, rpc_options: nil)
895
+ invoke_rpc(
896
+ rpc: 'get_deployment_reachability',
897
+ request_class: Temporalio::Api::WorkflowService::V1::GetDeploymentReachabilityRequest,
898
+ response_class: Temporalio::Api::WorkflowService::V1::GetDeploymentReachabilityResponse,
899
+ request:,
900
+ rpc_options:
901
+ )
902
+ end
903
+
904
+ # Calls WorkflowService.GetCurrentDeployment API call.
905
+ #
906
+ # @param request [Temporalio::Api::WorkflowService::V1::GetCurrentDeploymentRequest] API request.
907
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
908
+ # @return [Temporalio::Api::WorkflowService::V1::GetCurrentDeploymentResponse] API response.
909
+ def get_current_deployment(request, rpc_options: nil)
910
+ invoke_rpc(
911
+ rpc: 'get_current_deployment',
912
+ request_class: Temporalio::Api::WorkflowService::V1::GetCurrentDeploymentRequest,
913
+ response_class: Temporalio::Api::WorkflowService::V1::GetCurrentDeploymentResponse,
914
+ request:,
915
+ rpc_options:
916
+ )
917
+ end
918
+
919
+ # Calls WorkflowService.SetCurrentDeployment API call.
920
+ #
921
+ # @param request [Temporalio::Api::WorkflowService::V1::SetCurrentDeploymentRequest] API request.
922
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
923
+ # @return [Temporalio::Api::WorkflowService::V1::SetCurrentDeploymentResponse] API response.
924
+ def set_current_deployment(request, rpc_options: nil)
925
+ invoke_rpc(
926
+ rpc: 'set_current_deployment',
927
+ request_class: Temporalio::Api::WorkflowService::V1::SetCurrentDeploymentRequest,
928
+ response_class: Temporalio::Api::WorkflowService::V1::SetCurrentDeploymentResponse,
929
+ request:,
930
+ rpc_options:
931
+ )
932
+ end
933
+
934
+ # Calls WorkflowService.SetWorkerDeploymentCurrentVersion API call.
935
+ #
936
+ # @param request [Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentCurrentVersionRequest] API request.
937
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
938
+ # @return [Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentCurrentVersionResponse] API response.
939
+ def set_worker_deployment_current_version(request, rpc_options: nil)
940
+ invoke_rpc(
941
+ rpc: 'set_worker_deployment_current_version',
942
+ request_class: Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentCurrentVersionRequest,
943
+ response_class: Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentCurrentVersionResponse,
944
+ request:,
945
+ rpc_options:
946
+ )
947
+ end
948
+
949
+ # Calls WorkflowService.DescribeWorkerDeployment API call.
950
+ #
951
+ # @param request [Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentRequest] API request.
952
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
953
+ # @return [Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentResponse] API response.
954
+ def describe_worker_deployment(request, rpc_options: nil)
955
+ invoke_rpc(
956
+ rpc: 'describe_worker_deployment',
957
+ request_class: Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentRequest,
958
+ response_class: Temporalio::Api::WorkflowService::V1::DescribeWorkerDeploymentResponse,
959
+ request:,
960
+ rpc_options:
961
+ )
962
+ end
963
+
964
+ # Calls WorkflowService.DeleteWorkerDeployment API call.
965
+ #
966
+ # @param request [Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentRequest] API request.
967
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
968
+ # @return [Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentResponse] API response.
969
+ def delete_worker_deployment(request, rpc_options: nil)
970
+ invoke_rpc(
971
+ rpc: 'delete_worker_deployment',
972
+ request_class: Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentRequest,
973
+ response_class: Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentResponse,
974
+ request:,
975
+ rpc_options:
976
+ )
977
+ end
978
+
979
+ # Calls WorkflowService.DeleteWorkerDeploymentVersion API call.
980
+ #
981
+ # @param request [Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentVersionRequest] API request.
982
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
983
+ # @return [Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentVersionResponse] API response.
984
+ def delete_worker_deployment_version(request, rpc_options: nil)
985
+ invoke_rpc(
986
+ rpc: 'delete_worker_deployment_version',
987
+ request_class: Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentVersionRequest,
988
+ response_class: Temporalio::Api::WorkflowService::V1::DeleteWorkerDeploymentVersionResponse,
989
+ request:,
990
+ rpc_options:
991
+ )
992
+ end
993
+
994
+ # Calls WorkflowService.SetWorkerDeploymentRampingVersion API call.
995
+ #
996
+ # @param request [Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentRampingVersionRequest] API request.
997
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
998
+ # @return [Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentRampingVersionResponse] API response.
999
+ def set_worker_deployment_ramping_version(request, rpc_options: nil)
1000
+ invoke_rpc(
1001
+ rpc: 'set_worker_deployment_ramping_version',
1002
+ request_class: Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentRampingVersionRequest,
1003
+ response_class: Temporalio::Api::WorkflowService::V1::SetWorkerDeploymentRampingVersionResponse,
1004
+ request:,
1005
+ rpc_options:
1006
+ )
1007
+ end
1008
+
1009
+ # Calls WorkflowService.ListWorkerDeployments API call.
1010
+ #
1011
+ # @param request [Temporalio::Api::WorkflowService::V1::ListWorkerDeploymentsRequest] API request.
1012
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
1013
+ # @return [Temporalio::Api::WorkflowService::V1::ListWorkerDeploymentsResponse] API response.
1014
+ def list_worker_deployments(request, rpc_options: nil)
1015
+ invoke_rpc(
1016
+ rpc: 'list_worker_deployments',
1017
+ request_class: Temporalio::Api::WorkflowService::V1::ListWorkerDeploymentsRequest,
1018
+ response_class: Temporalio::Api::WorkflowService::V1::ListWorkerDeploymentsResponse,
1019
+ request:,
1020
+ rpc_options:
1021
+ )
1022
+ end
1023
+
1024
+ # Calls WorkflowService.UpdateWorkerDeploymentVersionMetadata API call.
1025
+ #
1026
+ # @param request [Temporalio::Api::WorkflowService::V1::UpdateWorkerDeploymentVersionMetadataRequest] API request.
1027
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
1028
+ # @return [Temporalio::Api::WorkflowService::V1::UpdateWorkerDeploymentVersionMetadataResponse] API response.
1029
+ def update_worker_deployment_version_metadata(request, rpc_options: nil)
1030
+ invoke_rpc(
1031
+ rpc: 'update_worker_deployment_version_metadata',
1032
+ request_class: Temporalio::Api::WorkflowService::V1::UpdateWorkerDeploymentVersionMetadataRequest,
1033
+ response_class: Temporalio::Api::WorkflowService::V1::UpdateWorkerDeploymentVersionMetadataResponse,
1034
+ request:,
1035
+ rpc_options:
1036
+ )
1037
+ end
1038
+
844
1039
  # Calls WorkflowService.UpdateWorkflowExecution API call.
845
1040
  #
846
1041
  # @param request [Temporalio::Api::WorkflowService::V1::UpdateWorkflowExecutionRequest] API request.
@@ -976,61 +1171,76 @@ module Temporalio
976
1171
  )
977
1172
  end
978
1173
 
979
- # Calls WorkflowService.UpdateActivityOptionsById API call.
1174
+ # Calls WorkflowService.UpdateActivityOptions API call.
1175
+ #
1176
+ # @param request [Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsRequest] API request.
1177
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
1178
+ # @return [Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsResponse] API response.
1179
+ def update_activity_options(request, rpc_options: nil)
1180
+ invoke_rpc(
1181
+ rpc: 'update_activity_options',
1182
+ request_class: Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsRequest,
1183
+ response_class: Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsResponse,
1184
+ request:,
1185
+ rpc_options:
1186
+ )
1187
+ end
1188
+
1189
+ # Calls WorkflowService.UpdateWorkflowExecutionOptions API call.
980
1190
  #
981
- # @param request [Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsByIdRequest] API request.
1191
+ # @param request [Temporalio::Api::WorkflowService::V1::UpdateWorkflowExecutionOptionsRequest] API request.
982
1192
  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
983
- # @return [Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsByIdResponse] API response.
984
- def update_activity_options_by_id(request, rpc_options: nil)
1193
+ # @return [Temporalio::Api::WorkflowService::V1::UpdateWorkflowExecutionOptionsResponse] API response.
1194
+ def update_workflow_execution_options(request, rpc_options: nil)
985
1195
  invoke_rpc(
986
- rpc: 'update_activity_options_by_id',
987
- request_class: Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsByIdRequest,
988
- response_class: Temporalio::Api::WorkflowService::V1::UpdateActivityOptionsByIdResponse,
1196
+ rpc: 'update_workflow_execution_options',
1197
+ request_class: Temporalio::Api::WorkflowService::V1::UpdateWorkflowExecutionOptionsRequest,
1198
+ response_class: Temporalio::Api::WorkflowService::V1::UpdateWorkflowExecutionOptionsResponse,
989
1199
  request:,
990
1200
  rpc_options:
991
1201
  )
992
1202
  end
993
1203
 
994
- # Calls WorkflowService.PauseActivityById API call.
1204
+ # Calls WorkflowService.PauseActivity API call.
995
1205
  #
996
- # @param request [Temporalio::Api::WorkflowService::V1::PauseActivityByIdRequest] API request.
1206
+ # @param request [Temporalio::Api::WorkflowService::V1::PauseActivityRequest] API request.
997
1207
  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
998
- # @return [Temporalio::Api::WorkflowService::V1::PauseActivityByIdResponse] API response.
999
- def pause_activity_by_id(request, rpc_options: nil)
1208
+ # @return [Temporalio::Api::WorkflowService::V1::PauseActivityResponse] API response.
1209
+ def pause_activity(request, rpc_options: nil)
1000
1210
  invoke_rpc(
1001
- rpc: 'pause_activity_by_id',
1002
- request_class: Temporalio::Api::WorkflowService::V1::PauseActivityByIdRequest,
1003
- response_class: Temporalio::Api::WorkflowService::V1::PauseActivityByIdResponse,
1211
+ rpc: 'pause_activity',
1212
+ request_class: Temporalio::Api::WorkflowService::V1::PauseActivityRequest,
1213
+ response_class: Temporalio::Api::WorkflowService::V1::PauseActivityResponse,
1004
1214
  request:,
1005
1215
  rpc_options:
1006
1216
  )
1007
1217
  end
1008
1218
 
1009
- # Calls WorkflowService.UnpauseActivityById API call.
1219
+ # Calls WorkflowService.UnpauseActivity API call.
1010
1220
  #
1011
- # @param request [Temporalio::Api::WorkflowService::V1::UnpauseActivityByIdRequest] API request.
1221
+ # @param request [Temporalio::Api::WorkflowService::V1::UnpauseActivityRequest] API request.
1012
1222
  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
1013
- # @return [Temporalio::Api::WorkflowService::V1::UnpauseActivityByIdResponse] API response.
1014
- def unpause_activity_by_id(request, rpc_options: nil)
1223
+ # @return [Temporalio::Api::WorkflowService::V1::UnpauseActivityResponse] API response.
1224
+ def unpause_activity(request, rpc_options: nil)
1015
1225
  invoke_rpc(
1016
- rpc: 'unpause_activity_by_id',
1017
- request_class: Temporalio::Api::WorkflowService::V1::UnpauseActivityByIdRequest,
1018
- response_class: Temporalio::Api::WorkflowService::V1::UnpauseActivityByIdResponse,
1226
+ rpc: 'unpause_activity',
1227
+ request_class: Temporalio::Api::WorkflowService::V1::UnpauseActivityRequest,
1228
+ response_class: Temporalio::Api::WorkflowService::V1::UnpauseActivityResponse,
1019
1229
  request:,
1020
1230
  rpc_options:
1021
1231
  )
1022
1232
  end
1023
1233
 
1024
- # Calls WorkflowService.ResetActivityById API call.
1234
+ # Calls WorkflowService.ResetActivity API call.
1025
1235
  #
1026
- # @param request [Temporalio::Api::WorkflowService::V1::ResetActivityByIdRequest] API request.
1236
+ # @param request [Temporalio::Api::WorkflowService::V1::ResetActivityRequest] API request.
1027
1237
  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
1028
- # @return [Temporalio::Api::WorkflowService::V1::ResetActivityByIdResponse] API response.
1029
- def reset_activity_by_id(request, rpc_options: nil)
1238
+ # @return [Temporalio::Api::WorkflowService::V1::ResetActivityResponse] API response.
1239
+ def reset_activity(request, rpc_options: nil)
1030
1240
  invoke_rpc(
1031
- rpc: 'reset_activity_by_id',
1032
- request_class: Temporalio::Api::WorkflowService::V1::ResetActivityByIdRequest,
1033
- response_class: Temporalio::Api::WorkflowService::V1::ResetActivityByIdResponse,
1241
+ rpc: 'reset_activity',
1242
+ request_class: Temporalio::Api::WorkflowService::V1::ResetActivityRequest,
1243
+ response_class: Temporalio::Api::WorkflowService::V1::ResetActivityResponse,
1034
1244
  request:,
1035
1245
  rpc_options:
1036
1246
  )
@@ -23,6 +23,8 @@ module Temporalio
23
23
  :args,
24
24
  :workflow_id,
25
25
  :task_queue,
26
+ :static_summary,
27
+ :static_details,
26
28
  :execution_timeout,
27
29
  :run_timeout,
28
30
  :task_timeout,
@@ -38,6 +40,26 @@ module Temporalio
38
40
  :rpc_options
39
41
  )
40
42
 
43
+ # Input for {Outbound.start_update_with_start_workflow}.
44
+ StartUpdateWithStartWorkflowInput = Data.define(
45
+ :update_id,
46
+ :update,
47
+ :args,
48
+ :wait_for_stage,
49
+ :start_workflow_operation,
50
+ :headers,
51
+ :rpc_options
52
+ )
53
+
54
+ # Input for {Outbound.signal_with_start_workflow}.
55
+ SignalWithStartWorkflowInput = Data.define(
56
+ :signal,
57
+ :args,
58
+ :start_workflow_operation,
59
+ # Headers intentionally not defined here, because they are not separate from start_workflow_operation
60
+ :rpc_options
61
+ )
62
+
41
63
  # Input for {Outbound.list_workflows}.
42
64
  ListWorkflowsInput = Data.define(
43
65
  :query,
@@ -240,6 +262,23 @@ module Temporalio
240
262
  next_interceptor.start_workflow(input)
241
263
  end
242
264
 
265
+ # Called for every {Client.start_update_with_start_workflow} and {Client.execute_update_with_start_workflow}
266
+ # call.
267
+ #
268
+ # @param input [StartUpdateWithStartWorkflowInput] Input.
269
+ # @return [WorkflowUpdateHandle] Workflow update handle.
270
+ def start_update_with_start_workflow(input)
271
+ next_interceptor.start_update_with_start_workflow(input)
272
+ end
273
+
274
+ # Called for every {Client.signal_with_start_workflow}.
275
+ #
276
+ # @param input [SignalWithStartWorkflowInput] Input.
277
+ # @return [WorkflowHandle] Workflow handle.
278
+ def signal_with_start_workflow(input)
279
+ next_interceptor.signal_with_start_workflow(input)
280
+ end
281
+
243
282
  # Called for every {Client.list_workflows} call.
244
283
  #
245
284
  # @param input [ListWorkflowsInput] Input.
@@ -167,6 +167,8 @@ module Temporalio
167
167
  :args,
168
168
  :id,
169
169
  :task_queue,
170
+ :static_summary,
171
+ :static_details,
170
172
  :execution_timeout,
171
173
  :run_timeout,
172
174
  :task_timeout,
@@ -186,6 +188,14 @@ module Temporalio
186
188
  # @return [String] Unique identifier for the workflow execution.
187
189
  # @!attribute task_queue
188
190
  # @return [String] Task queue to run the workflow on.
191
+ # @!attribute static_summary
192
+ # @return [String, nil] Fixed single-line summary for this workflow execution that may appear in CLI/UI.
193
+ # This can be in single-line Temporal markdown format. This is currently experimental.
194
+ # @!attribute static_details
195
+ # @return [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can be in
196
+ # Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
197
+ # updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is
198
+ # currently experimental.
189
199
  # @!attribute execution_timeout
190
200
  # @return [Float, nil] Total workflow execution timeout in seconds including retries and continue as new.
191
201
  # @!attribute run_timeout
@@ -212,6 +222,12 @@ module Temporalio
212
222
  # @param args [Array<Object>] Arguments to the workflow.
213
223
  # @param id [String] Unique identifier for the workflow execution.
214
224
  # @param task_queue [String] Task queue to run the workflow on.
225
+ # @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear
226
+ # in CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
227
+ # @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI.
228
+ # This can be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow
229
+ # that cannot be updated. For details that can be updated, use {Workflow.current_details=} within the
230
+ # workflow. This is currently experimental.
215
231
  # @param execution_timeout [Float, nil] Total workflow execution timeout in seconds including retries and
216
232
  # continue as new.
217
233
  # @param run_timeout [Float, nil] Timeout of a single workflow run in seconds.
@@ -225,6 +241,8 @@ module Temporalio
225
241
  *args,
226
242
  id:,
227
243
  task_queue:,
244
+ static_summary: nil,
245
+ static_details: nil,
228
246
  execution_timeout: nil,
229
247
  run_timeout: nil,
230
248
  task_timeout: nil,
@@ -238,6 +256,8 @@ module Temporalio
238
256
  args:,
239
257
  id:,
240
258
  task_queue:,
259
+ static_summary:,
260
+ static_details:,
241
261
  execution_timeout:,
242
262
  run_timeout:,
243
263
  task_timeout:,
@@ -251,11 +271,14 @@ module Temporalio
251
271
 
252
272
  # @!visibility private
253
273
  def self._from_proto(raw_info, data_converter)
274
+ (summary, details) = Internal::ProtoUtils.from_user_metadata(raw_info.user_metadata, data_converter)
254
275
  StartWorkflow.new(
255
276
  raw_info.workflow_type.name,
256
277
  *data_converter.from_payloads(raw_info.input),
257
278
  id: raw_info.workflow_id,
258
279
  task_queue: raw_info.task_queue.name,
280
+ static_summary: summary,
281
+ static_details: details,
259
282
  execution_timeout: Internal::ProtoUtils.duration_to_seconds(raw_info.workflow_execution_timeout),
260
283
  run_timeout: Internal::ProtoUtils.duration_to_seconds(raw_info.workflow_run_timeout),
261
284
  task_timeout: Internal::ProtoUtils.duration_to_seconds(raw_info.workflow_task_timeout),
@@ -280,7 +303,8 @@ module Temporalio
280
303
  retry_policy: retry_policy&._to_proto,
281
304
  memo: Internal::ProtoUtils.memo_to_proto(memo, data_converter),
282
305
  search_attributes: search_attributes&._to_proto,
283
- header: Internal::ProtoUtils.headers_to_proto(headers, data_converter)
306
+ header: Internal::ProtoUtils.headers_to_proto(headers, data_converter),
307
+ user_metadata: Internal::ProtoUtils.to_user_metadata(static_summary, static_details, data_converter)
284
308
  )
285
309
  )
286
310
  end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/common_enums'
4
+
5
+ module Temporalio
6
+ class Client
7
+ # Start operation used by {Client.start_update_with_start_workflow}, {Client.execute_update_with_start_workflow},
8
+ # and {Client.signal_with_start_workflow}.
9
+ class WithStartWorkflowOperation
10
+ Options = Data.define(
11
+ :workflow,
12
+ :args,
13
+ :id,
14
+ :task_queue,
15
+ :static_summary,
16
+ :static_details,
17
+ :execution_timeout,
18
+ :run_timeout,
19
+ :task_timeout,
20
+ :id_reuse_policy,
21
+ :id_conflict_policy,
22
+ :retry_policy,
23
+ :cron_schedule,
24
+ :memo,
25
+ :search_attributes,
26
+ :start_delay,
27
+ :headers
28
+ )
29
+
30
+ # Options the operation was created with.
31
+ class Options; end # rubocop:disable Lint/EmptyClass
32
+
33
+ # @return [Options] Options the operation was created with.
34
+ attr_accessor :options
35
+
36
+ # Create a with-start workflow operation. These are mostly the same options as {Client.start_workflow}, see that
37
+ # documentation for more details.
38
+ #
39
+ # Note, for {Client.start_update_with_start_workflow} and {Client.execute_update_with_start_workflow},
40
+ # `id_conflict_policy` is required.
41
+ def initialize(
42
+ workflow,
43
+ *args,
44
+ id:,
45
+ task_queue:,
46
+ static_summary: nil,
47
+ static_details: nil,
48
+ execution_timeout: nil,
49
+ run_timeout: nil,
50
+ task_timeout: nil,
51
+ id_reuse_policy: WorkflowIDReusePolicy::ALLOW_DUPLICATE,
52
+ id_conflict_policy: WorkflowIDConflictPolicy::UNSPECIFIED,
53
+ retry_policy: nil,
54
+ cron_schedule: nil,
55
+ memo: nil,
56
+ search_attributes: nil,
57
+ start_delay: nil,
58
+ headers: {}
59
+ )
60
+ @options = Options.new(
61
+ workflow: Workflow::Definition._workflow_type_from_workflow_parameter(workflow),
62
+ args:,
63
+ id:,
64
+ task_queue:,
65
+ static_summary:,
66
+ static_details:,
67
+ execution_timeout:,
68
+ run_timeout:,
69
+ task_timeout:,
70
+ id_reuse_policy:,
71
+ id_conflict_policy:,
72
+ retry_policy:,
73
+ cron_schedule:,
74
+ memo:,
75
+ search_attributes:,
76
+ start_delay:,
77
+ headers:
78
+ )
79
+ @workflow_handle_mutex = Mutex.new
80
+ @workflow_handle_cond_var = ConditionVariable.new
81
+ end
82
+
83
+ # Get the workflow handle, possibly waiting until set, or raise an error if the workflow start was unsuccessful.
84
+ #
85
+ # @param wait [Boolean] True to wait until it is set, false to return immediately.
86
+ #
87
+ # @return [WorkflowHandle, nil] The workflow handle when available or `nil` if `wait` is false and it is not set
88
+ # yet.
89
+ # @raise [Error] Any error that occurred during the call before the workflow start returned.
90
+ def workflow_handle(wait: true)
91
+ @workflow_handle_mutex.synchronize do
92
+ @workflow_handle_cond_var.wait(@workflow_handle_mutex) unless @workflow_handle || !wait
93
+ raise @workflow_handle if @workflow_handle.is_a?(Exception)
94
+
95
+ @workflow_handle
96
+ end
97
+ end
98
+
99
+ # @!visibility private
100
+ def _set_workflow_handle(value)
101
+ @workflow_handle_mutex.synchronize do
102
+ @workflow_handle ||= value
103
+ @workflow_handle_cond_var.broadcast
104
+ end
105
+ end
106
+
107
+ # @!visibility private
108
+ def _mark_used
109
+ raise 'Start operation already used' if @in_use
110
+
111
+ @in_use = true
112
+ end
113
+ end
114
+ end
115
+ end
@@ -93,6 +93,25 @@ module Temporalio
93
93
  def initialize(raw_description, data_converter)
94
94
  super(raw_description.workflow_execution_info, data_converter)
95
95
  @raw_description = raw_description
96
+ @data_converter = data_converter
97
+ end
98
+
99
+ # @return [String, nil] Static summary configured on the workflow. This is currently experimental.
100
+ def static_summary
101
+ user_metadata.first
102
+ end
103
+
104
+ # @return [String, nil] Static details configured on the workflow. This is currently experimental.
105
+ def static_details
106
+ user_metadata.last
107
+ end
108
+
109
+ private
110
+
111
+ def user_metadata
112
+ @user_metadata ||= Internal::ProtoUtils.from_user_metadata(
113
+ @raw_description.execution_config&.user_metadata, @data_converter
114
+ )
96
115
  end
97
116
  end
98
117
  end
@@ -222,7 +222,7 @@ module Temporalio
222
222
  @client._impl.signal_workflow(Interceptor::SignalWorkflowInput.new(
223
223
  workflow_id: id,
224
224
  run_id:,
225
- signal:,
225
+ signal: Workflow::Definition::Signal._name_from_parameter(signal),
226
226
  args:,
227
227
  headers: {},
228
228
  rpc_options:
@@ -254,7 +254,7 @@ module Temporalio
254
254
  @client._impl.query_workflow(Interceptor::QueryWorkflowInput.new(
255
255
  workflow_id: id,
256
256
  run_id:,
257
- query:,
257
+ query: Workflow::Definition::Query._name_from_parameter(query),
258
258
  args:,
259
259
  reject_condition:,
260
260
  headers: {},
@@ -291,7 +291,7 @@ module Temporalio
291
291
  workflow_id: self.id,
292
292
  run_id:,
293
293
  update_id: id,
294
- update:,
294
+ update: Workflow::Definition::Update._name_from_parameter(update),
295
295
  args:,
296
296
  wait_for_stage:,
297
297
  headers: {},