Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk Dispatch Workflows Enhancements #4842

Merged
merged 8 commits into from
Jan 26, 2024
Merged

Conversation

sfmskywalker
Copy link
Member

This PR updates the BulkDispatchWorkflows with support for async-enumerables and adds support for background execution of the activity itself. Before this PR, the activity would remain in the Suspended state when executed from the background due to the fact that its bookmarks were not synced with the persisted state.

A new BatchProcessing sample project has been added demonstrating how to process items in batches. ForEach and ParallelForEach activities were updated to allow using an IAsyncEnumerable as source. BulkDispatchWorkflows was also refactored to improve its efficiency and handling.
This update includes adding an optional input parameter to the ScheduleChildActivity signal's constructor in order to pass options to the child activity. The input parameter is used while scheduling activities in FlowFork.cs and Flowchart.cs activities. This enables clearer data transfer and scheduling in the system.
The version of Elsa.Studio and Elsa.Studio.Login.BlazorWasm in the Elsa.ServerAndStudio.Web project has been upgraded from 3.0.2 to 3.0.3. This update aims to incorporate the latest features and bug fixes from these packages.
Modified code formatting to enhance readability in several files including integration tests and workflow definitions. Order of project references in both Elsa.sln and Elsa.Server.Web.csproj files were rearranged. Unnecessary namespaces were also removed in BulkSuspendedWorkflow.cs and _build.csproj file saw a minor adjustment.
This update adds new keys to the default background activity invoker for task completion and bookmarks. It also modifies handling of dispatched workflow instances in BulkDispatchWorkflows activity. It further updates the BackgroundActivityInvokerMiddleware to capture and remove additional task details from the workflow execution context. Refactors are made to ObjectConverter and a set method for background completion is added to ActivityExecutionContextExtensions and BackgroundActivityExecutionContextExtensions.
@sfmskywalker sfmskywalker added elsa 3 This issue is specific to Elsa 3 enhancement New feature or request labels Jan 26, 2024
Removed the ItemSource property and related logic in ForEachT.cs. Instead of considering two sources (Items and ItemSource) for iterations, the code now only iterates over the Items collection. Additional logic has been added to initialize Items to an empty collection when it is not set.
The version of the System.ComponentModel.Annotations package was downgraded from 6.0.0-preview.4.21253.7 to 5.0.0 in the Elsa.Workflows.Core project. This could be due to compatibility issues or to match the version used in other components of the project.
@sfmskywalker sfmskywalker added this to the Elsa 3.1 milestone Jan 26, 2024
@sfmskywalker sfmskywalker merged commit d4171f3 into main Jan 26, 2024
1 of 2 checks passed
@sfmskywalker sfmskywalker deleted the feature/batch-processing branch January 26, 2024 20:27
/// <summary>
/// Gets the background outcomes.
/// </summary>
public static bool? GetBackgroundCompleted(this ActivityExecutionContext activityExecutionContext)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetBackgroundCompletion

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, that sounds more correct 👍🏻

yield break;

var itemsType = items.GetType();
if (itemsType.Name == "AsyncEnumerableAdapter`1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we can move away from the magic string here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I could discover - this is an internal or even private type. That being said, we may not need this capability of sending async enumerables once we have data sets, which would be the recommended approach when sending big data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elsa 3 This issue is specific to Elsa 3 enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants