mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 17:46:36 +00:00
add loader and versioning
This commit is contained in:
+17
-28
@@ -13,7 +13,6 @@ using Azaion.Common.Extensions;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.CommonSecurity;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
using Azaion.CommonSecurity.DTO.Commands;
|
||||
using Azaion.CommonSecurity.Services;
|
||||
using Azaion.Dataset;
|
||||
using CommandLine;
|
||||
@@ -35,7 +34,7 @@ public partial class App
|
||||
private FormState _formState = null!;
|
||||
private IHost _host = null!;
|
||||
private static readonly Guid KeyPressTaskId = Guid.NewGuid();
|
||||
|
||||
private LoaderClient _loaderClient = null!;
|
||||
|
||||
private readonly ICache _cache = new MemoryCache();
|
||||
private readonly CancellationTokenSource _mainCTokenSource = new();
|
||||
@@ -65,25 +64,13 @@ public partial class App
|
||||
|
||||
private void ErrorHandling(IEnumerable<Error> obj)
|
||||
{
|
||||
Log.Fatal($"Error happened: {string.Join(",", obj.Select(x => x.Tag))}");
|
||||
}
|
||||
|
||||
private static InitConfig ReadInitConfig()
|
||||
{
|
||||
try
|
||||
Log.Fatal($"Error happened: {string.Join(",", obj.Select(x =>
|
||||
{
|
||||
if (!File.Exists(SecurityConstants.CONFIG_PATH))
|
||||
throw new FileNotFoundException(SecurityConstants.CONFIG_PATH);
|
||||
var configStr = File.ReadAllText(SecurityConstants.CONFIG_PATH);
|
||||
var config = JsonConvert.DeserializeObject<InitConfig>(configStr);
|
||||
|
||||
return config ?? SecurityConstants.DefaultInitConfig;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return SecurityConstants.DefaultInitConfig;
|
||||
}
|
||||
if (x is MissingRequiredOptionError err)
|
||||
return $"{err.Tag} {err.NameInfo.NameText}";
|
||||
return x.Tag.ToString();
|
||||
} ))}");
|
||||
Current.Shutdown();
|
||||
}
|
||||
|
||||
private Stream GetSystemConfig(LoaderClient loaderClient, string apiDir)
|
||||
@@ -120,15 +107,15 @@ public partial class App
|
||||
private void Start(ApiCredentials credentials)
|
||||
{
|
||||
new ConfigUpdater().CheckConfig();
|
||||
var initConfig = ReadInitConfig();
|
||||
var initConfig = SecurityConstants.ReadInitConfig();
|
||||
var apiDir = initConfig.DirectoriesConfig.ApiResourcesDirectory;
|
||||
var loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _mainCTokenSource.Token);
|
||||
_loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _mainCTokenSource.Token);
|
||||
|
||||
#if DEBUG
|
||||
loaderClient.StartClient();
|
||||
_loaderClient.StartClient();
|
||||
#endif
|
||||
loaderClient.Connect(); //Client app should be already started by LoaderUI
|
||||
loaderClient.Login(credentials);
|
||||
_loaderClient.Connect(); //Client app should be already started by LoaderUI
|
||||
_loaderClient.Login(credentials);
|
||||
|
||||
var azaionApi = new AzaionApi(new HttpClient { BaseAddress = new Uri(initConfig.InferenceClientConfig.ApiUrl) }, _cache, credentials);
|
||||
|
||||
@@ -136,8 +123,8 @@ public partial class App
|
||||
.ConfigureAppConfiguration((_, config) => config
|
||||
.AddCommandLine(Environment.GetCommandLineArgs())
|
||||
.AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true)
|
||||
.AddJsonStream(GetSystemConfig(loaderClient, apiDir))
|
||||
.AddJsonStream(GetSecuredConfig(loaderClient, apiDir)))
|
||||
.AddJsonStream(GetSystemConfig(_loaderClient, apiDir))
|
||||
.AddJsonStream(GetSecuredConfig(_loaderClient, apiDir)))
|
||||
.UseSerilog()
|
||||
.ConfigureServices((context, services) =>
|
||||
{
|
||||
@@ -155,7 +142,7 @@ public partial class App
|
||||
#region External Services
|
||||
|
||||
services.ConfigureSection<LoaderClientConfig>(context.Configuration);
|
||||
services.AddSingleton(loaderClient);
|
||||
services.AddSingleton(_loaderClient);
|
||||
|
||||
services.ConfigureSection<InferenceClientConfig>(context.Configuration);
|
||||
services.AddSingleton<IInferenceClient, InferenceClient>();
|
||||
@@ -226,6 +213,8 @@ public partial class App
|
||||
protected override async void OnExit(ExitEventArgs e)
|
||||
{
|
||||
base.OnExit(e);
|
||||
_loaderClient.Stop();
|
||||
_loaderClient.Dispose();
|
||||
await _host.StopAsync();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,16 @@
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate>
|
||||
<VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds)))</VersionSeconds>
|
||||
|
||||
<AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
<InformationalVersion>$(AssemblyVersion)</InformationalVersion>
|
||||
<Copyright>Copyright @ $([System.DateTime]::UtcNow.ToString("yyyy")) Azaion LLC. All rights reserved.</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="GMap.NET.WinPresentation" Version="2.1.7" />
|
||||
@@ -53,4 +63,21 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="CopyLoaderUI" AfterTargets="Build">
|
||||
<PropertyGroup>
|
||||
<LoaderOutput>$(SolutionDir)Azaion.LoaderUI\bin\$(Configuration)\$(TargetFramework)\</LoaderOutput>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<LoaderFiles Include="$(LoaderOutput)Azaion.LoaderUI.exe" />
|
||||
<LoaderFiles Include="$(LoaderOutput)Azaion.LoaderUI.dll" />
|
||||
<LoaderFiles Include="$(LoaderOutput)Azaion.LoaderUI.runtimeconfig.json" />
|
||||
<LoaderFiles Include="$(LoaderOutput)Azaion.LoaderUI.deps.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(LoaderFiles)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />
|
||||
<Message Text="Copied Azaion.LoaderUI files to $(OutputPath)" Importance="high" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
call ..\Azaion.Inference\build_inference
|
||||
call ..\Azaion.Loader\build_loader
|
||||
call copy_loader_inf
|
||||
@@ -1,13 +1,3 @@
|
||||
rem Inference
|
||||
|
||||
set INFERENCE_PATH=%cd%\..\Azaion.Inference
|
||||
xcopy /E /Y %INFERENCE_PATH%\dist\azaion-inference %SUITE_FOLDER%
|
||||
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_10.dll %SUITE_FOLDER%
|
||||
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_plugin_10.dll %SUITE_FOLDER%
|
||||
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvonnxparser_10.dll %SUITE_FOLDER%
|
||||
copy %INFERENCE_PATH%\config.yaml %SUITE_FOLDER%
|
||||
|
||||
rem Gps Denied
|
||||
set DESTINATION=%SUITE_FOLDER%\gps-denied
|
||||
set GPS_DENIED=%cd%\..\..\gps-denied\
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
echo Build Cython app
|
||||
set CURRENT_DIR=%cd%
|
||||
|
||||
REM Change to the parent directory of the current location
|
||||
cd /d %~dp0
|
||||
|
||||
|
||||
robocopy "..\dist-azaion\_internal" "bin\Debug\net8.0-windows\_internal" /E
|
||||
robocopy "..\dist-dlls\_internal" "bin\Debug\net8.0-windows\_internal" /E
|
||||
|
||||
robocopy "..\dist-azaion" "bin\Debug\net8.0-windows" "azaion-inference.exe" "azaion-loader.exe"
|
||||
|
||||
cd /d %CURRENT_DIR%
|
||||
Reference in New Issue
Block a user