Skip to content

[Bug] Batch operation feature in the Temporal Python SDK doesn't work #927

Open
@DmitryZap

Description

@DmitryZap

What are you really trying to do?

I'm trying to use the batch operation feature in the Temporal Python SDK to reset multiple workflows at scale. This is particularly useful for maintenance and debugging operations on large numbers of workflows.

Describe the bug

When attempting to start a batch operation (specifically a workflow reset operation), the Temporal Python SDK throws an error: Unknown RPC call start_batch_operation. This indicates that the SDK is making an RPC call that is not recognized by the Temporal server, suggesting missing or unimplemented functionality for batch operations in the Python SDK.

Error log:

2025-06-17 20:10:50,930 - INFO - Processing 1 workflows
2025-06-17 20:10:50,930 - INFO - Resetting workflow 'demo-workflow-1750180163' with reset_type 'first_task'
2025-06-17 20:10:50,930 - ERROR - Failed to reset workflow 'demo-workflow-1750180163': Unknown RPC call start_batch_operation
2025-06-17 20:10:50,930 - ERROR - Error resetting workflow demo-workflow-1750180163: Unknown RPC call start_batch_operation
2025-06-17 20:10:50,930 - INFO - Reset 0 workflows successfully, 1 errors
2025-06-17 20:10:50,930 - INFO - Reset operation completed successfully

Minimal Reproduction

import grpc
from temporalio.api.workflowservice.v1 import workflow_service_pb2 as workflow_service
from temporalio.api.workflowservice.v1 import workflow_service_pb2_grpc as workflow_service_grpc
from temporalio.api.common.v1 import payload_pb2
from temporalio.api.batch.v1 import message_pb2 as batch_message

def run_batch_operation():
    # Create gRPC channel to Temporal server
    channel = grpc.insecure_channel('localhost:7233')
    stub = workflow_service_grpc.WorkflowServiceStub(channel)
    
    # Create batch operation request
    request = workflow_service.StartBatchOperationRequest(
        namespace="default",
        job_id="batch-reset-job-1",
        reason="Resetting workflows via gRPC",
        reset_operation=batch_message.BatchOperationReset(
            reset_type=workflow_service.RESET_TYPE_FIRST_WORKFLOW_TASK,
            reset_reapply_type=workflow_service.RESET_REAPPLY_TYPE_SIGNAL
        ),
    )
    
    try:
        # Execute batch operation via gRPC
        response = stub.StartBatchOperation(request)
        print(f"Batch operation started successfully. Job ID: {response.job_id}")
        print(f"Progress: {response.total_operation_count} workflows to process")
    except grpc.RpcError as e:
        print(f"gRPC call failed: {e.details()}")
        print(f"Error code: {e.code()}")

if __name__ == "__main__":
    run_batch_operation()

Environment/Versions

  • OS and processor: macOS Sonoma (Apple M1 Pro)
  • Temporal Version: Python SDK 1.3.0, Temporal Server 1.25.0
  • Are you using Docker or Kubernetes or building Temporal from source? Without docker and builds

Additional context

The error "Unknown RPC call start_batch_operation" suggests that the batch operation functionality might not be implemented in the Rust Core SDK used by the Temporal Python SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions