Skip to content

[Bug] Local activity without schedule_to_close_timeout is failing immediately #331

@cretz

Description

@cretz

Describe the bug

Only tested so far on 1.2.0. Example worker:

import asyncio
import logging
import time
from datetime import timedelta

from temporalio import activity, workflow
from temporalio.client import Client
from temporalio.worker import Worker


@activity.defn
async def get_time() -> float:
    activity.logger.info("Called get_time")
    return time.time()


@workflow.defn
class GreetingWorkflow:
    @workflow.run
    async def run(self) -> float:
        workflow.logger.info("Calling local activity")
        result = await workflow.execute_local_activity(
            get_time,
            # schedule_to_close_timeout=timedelta(seconds=10),
            start_to_close_timeout=timedelta(seconds=10),
        )
        workflow.logger.info("Local activity result: {result}")
        return result


async def main():
    logging.basicConfig(level=logging.INFO)
    # Start client
    client = await Client.connect("localhost:7233")

    # Run a worker for the workflow
    worker = Worker(
        client,
        task_queue="hello-local-activity-task-queue",
        workflows=[GreetingWorkflow],
        activities=[get_time],
    )
    await worker.run()


if __name__ == "__main__":
    asyncio.run(main())

Then when run via CLI like:

temporal workflow execute -t hello-local-activity-task-queue --type GreetingWorkflow

Result:

Running execution:
  WorkflowId  bb7a7e16-f979-4d0f-9ec9-9d4ce6e40021
  RunId       e7a9202b-d56c-4d6d-b473-e7555b306f0d
  Type        GreetingWorkflow
  Namespace   default
  TaskQueue   hello-local-activity-task-queue
  Args        []

Progress:
  ID          Time                    Type
   1  2023-06-19T13:30:17Z  WorkflowExecutionStarted
   2  2023-06-19T13:30:17Z  WorkflowTaskScheduled
   3  2023-06-19T13:30:17Z  WorkflowTaskStarted
   4  2023-06-19T13:30:17Z  WorkflowTaskCompleted
   5  2023-06-19T13:30:17Z  MarkerRecorded
   6  2023-06-19T13:30:17Z  WorkflowExecutionFailed

Result:
  Run Time: 1 seconds
  Status: FAILED
  Failure: &Failure{Message:Local Activity timed out,Source:,StackTrace:,Cause:&Failure{Message:Activity timed out,Source:,StackTrace:,Cause:nil,FailureType:Failure_TimeoutFailureInfo: ScheduleToClose,},FailureType:Failure_ActivityFailureInfo,}

But if schedule_to_close_timeout is uncommented it works.

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