Giter VIP home page Giter VIP logo

Comments (3)

davidmrdavid avatar davidmrdavid commented on June 21, 2024

Good observation, I'll take this on

from azure-functions-durable-python.

davidmrdavid avatar davidmrdavid commented on June 21, 2024

@anthonychu

I fixed start_new here: #93
Judging from call_activity's signature, it appears to already work. Below is a snippet showing that we already provide default values, note the i=None from DurableOrchestrationContext.py:

        self.call_activity = lambda n, i=None: call_activity_task(
            state=self.histories,
            name=n,
            input_=i)
        self.call_activity_with_retry = \
            lambda n, o, i=None: call_activity_with_retry_task(
                state=self.histories,
                retry_options=o,
                name=n,

Please let me know what you think

from azure-functions-durable-python.

davidmrdavid avatar davidmrdavid commented on June 21, 2024

Just triple checked, and this (call_activity with no input) already works, provided that the called Activity has a default value.

You can reproduce this yourself by modifying the function_chaining sample as follows:

The new DurableActivity.py:

def main(name: str="Bob") -> str:
    """Activity function performing a specific step in the chain
    
    Parameters
    ----------
    name : str
        Name of the item to be hello'ed at 
    
    Returns
    -------
    str
        Returns a welcome string
    """
    return f'Hello : {name}!'

The new DurableOrchestration:

import logging

import azure.functions as func
import azure.durable_functions as df


def orchestrator_function(context: df.DurableOrchestrationContext):
    """This function provides the core function chaining orchestration logic

    Parameters
    ----------
    context: DurableOrchestrationContext
        This context has the past history
        and the durable orchestration API's to chain a set of functions

    Returns
    -------
    final_result: str
        Returns the final result after the chain completes

    Yields
    -------
    call_activity: str
        Yields at every step of the function chain orchestration logic
    """

    # Chained functions - output of a function is passed as
    # input to the next function in the chain

   # Note, in this case, there's no actual chaining
    final_result = yield context.call_activity("DurableActivity")

    return final_result


main = df.Orchestrator.create(orchestrator_function)

I'll close this issue, for now. Please feel free to re-open it if necessary πŸ˜„

from azure-functions-durable-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.