mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:46:30 +00:00
fix queue update
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
namespace Azaion.CommonSecurity.DTO;
|
namespace Azaion.CommonSecurity.DTO;
|
||||||
|
|
||||||
public class DirectoriesConfig
|
public class DirectoriesConfig
|
||||||
|
|
||||||
{
|
{
|
||||||
public string ApiResourcesDirectory { get; set; } = null!;
|
public string ApiResourcesDirectory { get; set; } = null!;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ public abstract class ExternalClientConfig
|
|||||||
public int RetryCount {get;set;}
|
public int RetryCount {get;set;}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InferenceClientConfig : ExternalClientConfig;
|
public class InferenceClientConfig : ExternalClientConfig
|
||||||
|
{
|
||||||
|
public string ApiUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class GpsDeniedClientConfig : ExternalClientConfig
|
public class GpsDeniedClientConfig : ExternalClientConfig
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ public class SecurityConstants
|
|||||||
public const string DUMMY_DIR = "dummy";
|
public const string DUMMY_DIR = "dummy";
|
||||||
|
|
||||||
#region ExternalClientsConfig
|
#region ExternalClientsConfig
|
||||||
//public const string API_URL = "http://localhost:5219";
|
|
||||||
public const string API_URL = "https://api.azaion.com";
|
|
||||||
|
|
||||||
public const string EXTERNAL_INFERENCE_PATH = "azaion-inference.exe";
|
public const string EXTERNAL_INFERENCE_PATH = "azaion-inference.exe";
|
||||||
public const string EXTERNAL_GPS_DENIED_FOLDER = "gps-denied";
|
public const string EXTERNAL_GPS_DENIED_FOLDER = "gps-denied";
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentia
|
|||||||
|
|
||||||
public void UpdateOffsets(UserQueueOffsets offsets)
|
public void UpdateOffsets(UserQueueOffsets offsets)
|
||||||
{
|
{
|
||||||
Put($"/users/queue-offsets/{CurrentUser.Email}", offsets);
|
Put($"/users/queue-offsets/set", new
|
||||||
|
{
|
||||||
|
Email = CurrentUser.Email,
|
||||||
|
Offsets = offsets
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpResponseMessage Send(HttpRequestMessage request)
|
private HttpResponseMessage Send(HttpRequestMessage request)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class InferenceClient : IInferenceClient
|
|||||||
process.StartInfo = new ProcessStartInfo
|
process.StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = SecurityConstants.EXTERNAL_INFERENCE_PATH,
|
FileName = SecurityConstants.EXTERNAL_INFERENCE_PATH,
|
||||||
//Arguments = $"-e {credentials.Email} -p {credentials.Password} -f {apiConfig.ResourcesFolder}",
|
Arguments = $"--port {_inferenceClientConfig.ZeroMqPort} --api {_inferenceClientConfig.ApiUrl}",
|
||||||
//RedirectStandardOutput = true,
|
//RedirectStandardOutput = true,
|
||||||
//RedirectStandardError = true,
|
//RedirectStandardError = true,
|
||||||
//CreateNoWindow = true
|
//CreateNoWindow = true
|
||||||
@@ -57,7 +57,6 @@ public class InferenceClient : IInferenceClient
|
|||||||
_dealer.Options.Identity = Encoding.UTF8.GetBytes(_clientId.ToString("N"));
|
_dealer.Options.Identity = Encoding.UTF8.GetBytes(_clientId.ToString("N"));
|
||||||
_dealer.Connect($"tcp://{_inferenceClientConfig.ZeroMqHost}:{_inferenceClientConfig.ZeroMqPort}");
|
_dealer.Connect($"tcp://{_inferenceClientConfig.ZeroMqHost}:{_inferenceClientConfig.ZeroMqPort}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ProcessClientCommands()
|
private async Task ProcessClientCommands()
|
||||||
{
|
{
|
||||||
//TODO: implement always on ready to client's requests. Utilize RemoteCommand
|
//TODO: implement always on ready to client's requests. Utilize RemoteCommand
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
zmq_port: 5131
|
|
||||||
api_url: https://api.azaion.com
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
zmq_port: 5127
|
|
||||||
api_url: http://localhost:5219
|
|
||||||
@@ -13,7 +13,6 @@ from remote_command cimport RemoteCommand, CommandType
|
|||||||
from remote_command_handler cimport RemoteCommandHandler
|
from remote_command_handler cimport RemoteCommandHandler
|
||||||
from credentials cimport Credentials
|
from credentials cimport Credentials
|
||||||
from file_data cimport FileData
|
from file_data cimport FileData
|
||||||
from user cimport User
|
|
||||||
|
|
||||||
cdef class CommandProcessor:
|
cdef class CommandProcessor:
|
||||||
cdef ApiClient api_client
|
cdef ApiClient api_client
|
||||||
@@ -22,12 +21,7 @@ cdef class CommandProcessor:
|
|||||||
cdef bint running
|
cdef bint running
|
||||||
cdef Inference inference
|
cdef Inference inference
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, int zmq_port, str api_url):
|
||||||
with open(<str>constants.CONFIG_FILE, "r") as f:
|
|
||||||
config = yaml.safe_load(f)
|
|
||||||
zmq_port = config["zmq_port"]
|
|
||||||
api_url = config["api_url"]
|
|
||||||
|
|
||||||
self.api_client = ApiClient(api_url)
|
self.api_client = ApiClient(api_url)
|
||||||
self.remote_handler = RemoteCommandHandler(zmq_port, self.on_command)
|
self.remote_handler = RemoteCommandHandler(zmq_port, self.on_command)
|
||||||
self.inference_queue = Queue(maxsize=constants.QUEUE_MAXSIZE)
|
self.inference_queue = Queue(maxsize=constants.QUEUE_MAXSIZE)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
from main import CommandProcessor
|
from main import CommandProcessor
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start(zmq_port, api_url):
|
||||||
processor = CommandProcessor()
|
processor = CommandProcessor(zmq_port, api_url)
|
||||||
try:
|
try:
|
||||||
processor.start()
|
processor.start()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@@ -10,4 +11,9 @@ def start():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start()
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-p", "--port", type=str, default="5127", help="zero mq port")
|
||||||
|
parser.add_argument("-a", "--api", type=str, default="https://api.azaion.com", help="api url")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
start(int(args.port), args.api)
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public partial class App
|
|||||||
login.CredentialsEntered += (_, credentials) =>
|
login.CredentialsEntered += (_, credentials) =>
|
||||||
{
|
{
|
||||||
_inferenceClient.Send(RemoteCommand.Create(CommandType.Login, credentials));
|
_inferenceClient.Send(RemoteCommand.Create(CommandType.Login, credentials));
|
||||||
_azaionApi = new AzaionApi(new HttpClient { BaseAddress = new Uri(SecurityConstants.API_URL) }, _cache, credentials);
|
_azaionApi = new AzaionApi(new HttpClient { BaseAddress = new Uri(secureAppConfig.InferenceClientConfig.ApiUrl) }, _cache, credentials);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"ZeroMqHost": "127.0.0.1",
|
"ZeroMqHost": "127.0.0.1",
|
||||||
"ZeroMqPort": 5127,
|
"ZeroMqPort": 5127,
|
||||||
"RetryCount": 25,
|
"RetryCount": 25,
|
||||||
"TimeoutSeconds": 5
|
"TimeoutSeconds": 5,
|
||||||
|
"ApiUrl": "https://api.azaion.com"
|
||||||
},
|
},
|
||||||
"GpsDeniedClientConfig": {
|
"GpsDeniedClientConfig": {
|
||||||
"ZeroMqHost": "127.0.0.1",
|
"ZeroMqHost": "127.0.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user