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

FIX: worker issues with Orkes Conductor API & other issues #123

Merged
merged 12 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Conductor/Client/Authentication/TokenHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ private string GetTokenFromServer(OrkesAuthenticationSettings authenticationSett
{
try
{
return tokenClient.GenerateToken(tokenRequest)._token;
var token = tokenClient.GenerateToken(tokenRequest);
return token._token;
}
catch (ApiException e)
{
if (e.ErrorCode == 405 || e.ErrorCode == 404)
{
throw new Exception($"Error while getting authentication token. Is the config BasePath correct? {tokenClient.Configuration.BasePath}");
}
}
catch (Exception e)
{
Expand Down
21 changes: 2 additions & 19 deletions Conductor/Client/Models/WorkflowTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
Expand Down Expand Up @@ -225,24 +224,8 @@ public enum WorkflowTaskTypeEnum
/// <param name="workflowTaskType">workflowTaskType.</param>
public WorkflowTask(bool? asyncComplete = default(bool?), string caseExpression = default(string), string caseValueParam = default(string), Dictionary<string, List<WorkflowTask>> decisionCases = default(Dictionary<string, List<WorkflowTask>>), List<WorkflowTask> defaultCase = default(List<WorkflowTask>), List<string> defaultExclusiveJoinTask = default(List<string>), string description = default(string), string dynamicForkJoinTasksParam = default(string), string dynamicForkTasksInputParamName = default(string), string dynamicForkTasksParam = default(string), string dynamicTaskNameParam = default(string), string evaluatorType = default(string), string expression = default(string), List<List<WorkflowTask>> forkTasks = default(List<List<WorkflowTask>>), Dictionary<string, Object> inputParameters = default(Dictionary<string, Object>), List<string> joinOn = default(List<string>), string loopCondition = default(string), List<WorkflowTask> loopOver = default(List<WorkflowTask>), string name = default(string), bool? optional = default(bool?), bool? rateLimited = default(bool?), int? retryCount = default(int?), string scriptExpression = default(string), string sink = default(string), int? startDelay = default(int?), SubWorkflowParams subWorkflowParam = default(SubWorkflowParams), TaskDef taskDefinition = default(TaskDef), string taskReferenceName = default(string), string type = default(string), WorkflowTaskTypeEnum? workflowTaskType = default(WorkflowTaskTypeEnum?), Dictionary<string, StateChangeConfig> onStateChange = default(Dictionary<string, StateChangeConfig>))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new InvalidDataException("name is a required property for WorkflowTask and cannot be null");
}
else
{
this.Name = name;
}
// to ensure "taskReferenceName" is required (not null)
if (taskReferenceName == null)
{
throw new InvalidDataException("taskReferenceName is a required property for WorkflowTask and cannot be null");
}
else
{
this.TaskReferenceName = taskReferenceName;
}
this.TaskReferenceName = taskReferenceName;
v1r3n marked this conversation as resolved.
Show resolved Hide resolved
this.Name = name;
this.AsyncComplete = asyncComplete;
this.CaseExpression = caseExpression;
this.CaseValueParam = caseValueParam;
Expand Down
2 changes: 1 addition & 1 deletion Conductor/conductor-csharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="110.2.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="110.2.0" />
<None Include="/package/Conductor/README.md" Pack="true" PackagePath="/" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion Tests/conductor-csharp.test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
Expand All @@ -9,6 +9,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Conductor/conductor-csharp.csproj" />
<ProjectReference Include="../csharp-examples/csharp-examples.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="TestData\integration_data.json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public void AuditLog(object workflowInput, string status, string name)
}

[WorkerTask(taskType: "simple_task_1", batchSize: 5, pollIntervalMs: 200, workerId: "workerId")]
public static string SimpleTask1(Task task)
public static string SimpleTask1(Conductor.Client.Models.Task task)
{
return "OK";
}

[WorkerTask(taskType: "simple_task_2", batchSize: 5, pollIntervalMs: 200, workerId: "workerId")]
public static TaskResult SimpleTask2(Task task)
public static TaskResult SimpleTask2(Conductor.Client.Models.Task task)
{
return new TaskResult { Status = TaskResult.StatusEnum.FAILEDWITHTERMINALERROR };
}
Expand Down
2 changes: 1 addition & 1 deletion csharp-examples/csharp-examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Conductor\conductor-csharp.csproj" />
<ProjectReference Include="../Conductor/conductor-csharp.csproj" />
</ItemGroup>

</Project>
Loading