修改 文件包回调执行时间
This commit is contained in:
parent
655ee7ea5f
commit
6b9fc167ee
|
|
@ -52,7 +52,7 @@
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
|
|
||||||
<DescriptionsItem Title="任务时间轴" Span="5">
|
<DescriptionsItem Title="任务时间轴" Span="5">
|
||||||
<Steps Current="@RowSTIndex(rowData)" Status="@RowSTStatus(rowData)">
|
<Steps Current="@((int)rowData.Data.LastEnum)" Status="@rowData.Data.TaskStatus">
|
||||||
<Step Title="下载文件"
|
<Step Title="下载文件"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" />
|
Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,15 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
item.StartTimeDic = System.Text.Json.JsonSerializer.Deserialize<Dictionary<RedisChannelEnum, DateTime>>(data[2]) ?? null;
|
item.StartTimeDic = System.Text.Json.JsonSerializer.Deserialize<Dictionary<RedisChannelEnum, DateTime>>(data[2]) ?? null;
|
||||||
item.ErrorMessage = data[3];
|
item.ErrorMessage = data[3];
|
||||||
rowRestartLoading = false;
|
rowRestartLoading = false;
|
||||||
|
var statusStr = "wait";
|
||||||
|
var dic = rowData.Data.StartTimeDic;
|
||||||
|
if (dic is null)
|
||||||
|
statusStr= "wait";
|
||||||
|
else if (!string.IsNullOrEmpty(rowData.Data.ErrorMessage))
|
||||||
|
statusStr= "error";
|
||||||
|
else if (dic.ContainsKey(RedisChannelEnum.EndTask))
|
||||||
|
statusStr= "finish";
|
||||||
|
item.TaskStatus = statusStr;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -144,24 +153,10 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
return "--";
|
return "--";
|
||||||
return dic[e].ToString();
|
return dic[e].ToString();
|
||||||
}
|
}
|
||||||
private string RowSTStatus(RowData<VideoTaskDto> rowData)
|
|
||||||
{
|
|
||||||
var dic = rowData.Data.StartTimeDic;
|
|
||||||
if (dic is null)
|
|
||||||
return "wait";
|
|
||||||
if (!string.IsNullOrEmpty(rowData.Data.ErrorMessage))
|
|
||||||
return "error";
|
|
||||||
if (dic.ContainsKey(RedisChannelEnum.EndTask))
|
|
||||||
return "finish";
|
|
||||||
return "wait";
|
|
||||||
}
|
|
||||||
private int RowSTIndex(RowData<VideoTaskDto> rowData)
|
|
||||||
{
|
|
||||||
return (int)rowData.Data.LastEnum;
|
|
||||||
}
|
|
||||||
private void OnExpand(RowData<VideoTaskDto> rowData)
|
private void OnExpand(RowData<VideoTaskDto> rowData)
|
||||||
{
|
{
|
||||||
RowRload(rowData);
|
if(rowData.Expanded)
|
||||||
|
RowRload(rowData);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在渲染页面之后
|
/// 在渲染页面之后
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ using FFmpeg.NET.Services;
|
||||||
using static FFmpeg.NET.MetaData;
|
using static FFmpeg.NET.MetaData;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
using Yitter.IdGenerator;
|
using Yitter.IdGenerator;
|
||||||
|
using VideoAnalysisCore.AICore.GPT.Dto;
|
||||||
|
|
||||||
namespace Learn.VideoAnalysis.Controllers
|
namespace Learn.VideoAnalysis.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -77,6 +78,7 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
[HttpPost(Name = "NodePackage")]
|
[HttpPost(Name = "NodePackage")]
|
||||||
public async Task<IActionResult> NodePackage(NodePackageReq req)
|
public async Task<IActionResult> NodePackage(NodePackageReq req)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"{DateTime.Now} 文件包订阅请求 req=" + JsonSerializer.Serialize(req));
|
||||||
if (req is null || req.NodeId == 0)
|
if (req is null || req.NodeId == 0)
|
||||||
return BadRequest("ÎÞЧµÄÌá½»Êý¾Ý");
|
return BadRequest("ÎÞЧµÄÌá½»Êý¾Ý");
|
||||||
if (req.AnalyzeItems is null || req.AnalyzeItems.Count() == 0)
|
if (req.AnalyzeItems is null || req.AnalyzeItems.Count() == 0)
|
||||||
|
|
@ -94,12 +96,8 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
StructurePageContentId = s.StructurePageContentId,
|
StructurePageContentId = s.StructurePageContentId,
|
||||||
};
|
};
|
||||||
nodePackages.Add(np);
|
nodePackages.Add(np);
|
||||||
|
|
||||||
if (videoIdArr.Contains(s.VideoCode))
|
if (videoIdArr.Contains(s.VideoCode))
|
||||||
{
|
|
||||||
Console.WriteLine($"重复任务");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
videos.Add(new VideoTask()
|
videos.Add(new VideoTask()
|
||||||
{
|
{
|
||||||
Id = YitIdHelper.NextId(),
|
Id = YitIdHelper.NextId(),
|
||||||
|
|
@ -113,9 +111,10 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
MediaName = s.VideoName
|
MediaName = s.VideoName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await nodePackageInfoDB.InsertRangeAsync(nodePackages);
|
await nodePackageInfoDB.InsertRangeAsync(nodePackages);
|
||||||
await videoTaskDB.InsertRangeAsync(videos);
|
await videoTaskDB.InsertRangeAsync(videos);
|
||||||
|
if (videos is null || videos.Count == 0)
|
||||||
|
return Ok();
|
||||||
var ids = videos.Select(s => s.Id).ToArray();
|
var ids = videos.Select(s => s.Id).ToArray();
|
||||||
RedisExpand.JoinQueue(ids);
|
RedisExpand.JoinQueue(ids);
|
||||||
return Ok();
|
return Ok();
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ namespace Learn.VideoAnalysis.Expand
|
||||||
//每5分钟执行一次 未处理视频扫描
|
//每5分钟执行一次 未处理视频扫描
|
||||||
scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes();
|
scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes();
|
||||||
//文件包分析
|
//文件包分析
|
||||||
scheduler.Schedule<NodePackageJob>().HourlyAt(10);
|
scheduler.Schedule<NodePackageJob>().EveryThirtyMinutes(); //每30分钟执行一次
|
||||||
//任务缓存清理
|
//任务缓存清理
|
||||||
// scheduler.Schedule<TaskFileClearJob>().HourlyAt(10);
|
// scheduler.Schedule<TaskFileClearJob>().HourlyAt(10);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ namespace Learn.VideoAnalysis
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx
|
||||||
if (!string.IsNullOrEmpty(stream.Result.Text))
|
if (!string.IsNullOrEmpty(stream.Result.Text))
|
||||||
{
|
{
|
||||||
var text = stream.Result.Text.Trim();
|
var text = stream.Result.Text.Trim();
|
||||||
if (text.Length == 1 && text.First() >= '\uFF00' && text.First() <= '\uFFEF') // 检查字符是否在全角半角字符集的标点符号范围内
|
if (text.Length == 1 && text == "。")// 检查字符是否只有一个句号
|
||||||
{
|
{
|
||||||
VAD.Pop();
|
VAD.Pop();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,8 @@ namespace VideoAnalysisCore.Common
|
||||||
/// <param name="taskIds"></param>
|
/// <param name="taskIds"></param>
|
||||||
public static void JoinQueue(params long[] taskIds)
|
public static void JoinQueue(params long[] taskIds)
|
||||||
{ //事务
|
{ //事务
|
||||||
|
if (taskIds is null || taskIds.Length == 0)
|
||||||
|
return;
|
||||||
using (var tran = Redis.Multi())
|
using (var tran = Redis.Multi())
|
||||||
{
|
{
|
||||||
foreach (var item in taskIds)
|
foreach (var item in taskIds)
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,11 @@ namespace VideoAnalysisCore.Job
|
||||||
.UpdateColumns(it => new { it.SuccessTime })
|
.UpdateColumns(it => new { it.SuccessTime })
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var res = await responseMessage.Content.ReadAsStringAsync();
|
||||||
|
Console.WriteLine($"{DateTime.Now} Invoke=>文件包任务 回调失败!!! {responseMessage.StatusCode} {res}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,11 @@ namespace VideoAnalysisCore.Model.Dto
|
||||||
/// 开始时间轴
|
/// 开始时间轴
|
||||||
/// <para>逻辑字段</para>
|
/// <para>逻辑字段</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<RedisChannelEnum, DateTime>? StartTimeDic {get; set;}
|
public Dictionary<RedisChannelEnum, DateTime>? StartTimeDic {get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 任务处理状态
|
||||||
|
/// <para>逻辑字段</para>
|
||||||
|
/// </summary>
|
||||||
|
public string? TaskStatus { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue