public ToolRunServer(RunServerOptions options, ServerConfiguration config, IKernel kernel, IGluonHostPool hostPool) { Options = options; Config = config; Kernel = kernel; HostPool = hostPool; }
public ToolRunServer(RunServerOptions options, ServerConfiguration config, IKernel kernel, IGluonHostPool hostPool) { this.Options = options; this.Config = config; this.Kernel = kernel; this.HostPool = hostPool; }
public AdminTasksController(IDAFactory daFactory, JWTFactory jwt, IGluonHostPool hostPool) : base("/admin") { JWTTokenAuthentication.Enable(this, jwt); Get["/tasks"] = _ => { this.DemandAdmin(); using (var da = daFactory.Get) { var offset = Request.Query["offset"]; var limit = Request.Query["limit"]; if (offset == null) { offset = 0; } if (limit == null) { limit = 20; } if (limit > 100) { limit = 100; } var result = da.Tasks.All((int)offset, (int)limit); return(Response.AsPagedList(result)); } }; Post["/tasks/request"] = x => { var task = this.Bind <TaskRequest>(); var taskServer = hostPool.GetByRole(Database.DA.Hosts.DbHostRole.task).FirstOrDefault(); if (taskServer == null) { return(Response.AsJson(-1)); } else { try { var id = taskServer.Call(new RequestTask() { TaskType = task.task_type.ToString(), ParameterJson = JsonConvert.SerializeObject(task.parameter), ShardId = (task.shard_id == null || !task.shard_id.HasValue) ? -1 : task.shard_id.Value }).Result; return(Response.AsJson(id)); }catch (Exception ex) { return(Response.AsJson(-1)); } } }; }
public AdminHostsController(IDAFactory daFactory, JWTFactory jwt, IGluonHostPool hostPool) : base("/admin") { JWTTokenAuthentication.Enable(this, jwt); this.Get["/hosts"] = _ => { this.DemandAdmin(); var hosts = hostPool.GetAll(); return(Response.AsJson(hosts.Select(x => new { role = x.Role, call_sign = x.CallSign, internal_host = x.InternalHost, public_host = x.PublicHost, connected = x.Connected, time_boot = x.BootTime }))); }; }
public GluonAuthenticationHandler(ISessions sessions, ServerConfiguration config, IGluonHostPool hostPool) { this.Sessions = sessions; this.Secret = config.Secret; this.HostPool = hostPool; }
public BirthdayGiftTask(IDAFactory DAFactory, TaskTuning tuning, IGluonHostPool hostPool) { this.DAFactory = DAFactory; this.Tuning = tuning; this.HostPool = hostPool; }
public NeighborhoodsTask(IDAFactory DAFactory, IGluonHostPool hostPool) { this.DAFactory = DAFactory; this.HostPool = hostPool; }
public JobBalanceTask(IDAFactory DAFactory, TaskTuning tuning, IGluonHostPool hosts) { this.DAFactory = DAFactory; this.Tuning = tuning; this.HostPool = hosts; }