-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dashboard-taskrun-json
- Loading branch information
Showing
36 changed files
with
646 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ lhctl/lhctl | |
local-dev/certs/ | ||
build/ | ||
.config | ||
*.pem | ||
|
||
# Python | ||
__pycache__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
sdk-dotnet/Examples/MaskedFieldsExample/MaskedFieldsExample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Worker"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\LittleHorse.Sdk\LittleHorse.Sdk.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Examples.BasicExample; | ||
using LittleHorse.Sdk; | ||
using LittleHorse.Sdk.Worker; | ||
|
||
public class Program | ||
{ | ||
private static ServiceProvider? _serviceProvider; | ||
private static void SetupApplication() | ||
{ | ||
_serviceProvider = new ServiceCollection() | ||
.AddLogging(config => | ||
{ | ||
config.AddConsole(); | ||
config.SetMinimumLevel(LogLevel.Debug); | ||
}) | ||
.BuildServiceProvider(); | ||
} | ||
|
||
private static LHConfig GetLHConfig(string[] args, ILoggerFactory loggerFactory) | ||
{ | ||
var config = new LHConfig(loggerFactory); | ||
|
||
string filePath = Path.Combine(Directory.GetCurrentDirectory(), ".config/littlehorse.config"); | ||
if (File.Exists(filePath)) | ||
config = new LHConfig(filePath, loggerFactory); | ||
|
||
return config; | ||
} | ||
|
||
static void Main(string[] args) | ||
{ | ||
SetupApplication(); | ||
if (_serviceProvider != null) | ||
{ | ||
var loggerFactory = _serviceProvider.GetRequiredService<ILoggerFactory>(); | ||
var config = GetLHConfig(args, loggerFactory); | ||
|
||
MyWorker executableCreateGreet = new MyWorker(); | ||
var taskWorkerCreate = new LHTaskWorker<MyWorker>(executableCreateGreet, "create-greet", config); | ||
MyWorker executableUpdateGreet = new MyWorker(); | ||
var taskWorkerUpdate = new LHTaskWorker<MyWorker>(executableUpdateGreet, "update-greet", config); | ||
MyWorker executableDeleteGreet = new MyWorker(); | ||
var taskWorkerDelete = new LHTaskWorker<MyWorker>(executableDeleteGreet, "delete-greet", config); | ||
|
||
taskWorkerCreate.RegisterTaskDef(); | ||
taskWorkerUpdate.RegisterTaskDef(); | ||
taskWorkerDelete.RegisterTaskDef(); | ||
|
||
Thread.Sleep(1000); | ||
|
||
taskWorkerCreate.Start(); | ||
taskWorkerUpdate.Start(); | ||
taskWorkerDelete.Start(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Running MaskedFields Example | ||
|
||
This is a simple example, that masks input params and output results in LH Task Methods. | ||
|
||
Let's run the example in `MaskedFieldsExample` | ||
|
||
``` | ||
dotnet build | ||
dotnet run | ||
``` | ||
|
||
In another terminal, use `lhctl` to run the workflow: | ||
|
||
``` | ||
# The "masked-name" variable should mask the value | ||
# And the input-name variable value will mantain the original plain text | ||
lhctl run example-basic masked-name pii-info input-name foo | ||
``` | ||
|
||
In addition, you can check the result with: | ||
|
||
``` | ||
# This call shows the result | ||
lhctl get wfRun <wf_run_id> | ||
# This will show you all nodes in tha run | ||
lhctl list nodeRun <wf_run_id> | ||
# This shows the task run information | ||
lhctl get taskRun <wf_run_id> <task_run_global_id> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using LittleHorse.Sdk.Worker; | ||
|
||
namespace Examples.BasicExample | ||
{ | ||
public class MyWorker | ||
{ | ||
[LHTaskMethod("create-greet")] | ||
[LHType(masked: true)] | ||
public string CreateGreeting([LHType(masked: true)] string name) | ||
{ | ||
var message = $"Hello team, This is a New Greeting for {name}"; | ||
Console.WriteLine($"Executing task create greet {name}"); | ||
return message; | ||
} | ||
|
||
[LHTaskMethod("update-greet")] | ||
public string UpdateGreeting([LHType(masked: true)] string name) | ||
{ | ||
var message = $"Hello team, This is Greeting Modification {name}"; | ||
Console.WriteLine($"Executing task update greet {name}"); | ||
return message; | ||
} | ||
|
||
[LHTaskMethod("delete-greet")] | ||
public string DeleteGreeting(string name) | ||
{ | ||
var message = $"Hello team, This is a Greeting Deletion {name}"; | ||
Console.WriteLine($"Executing task delete greet {name}"); | ||
return message; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.