This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into mgreisen/archivemsg
- Loading branch information
Showing
90 changed files
with
2,545 additions
and
1,742 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8.6.3 | ||
8.7.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System.Text.Json; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.OneFuzz.Service.OneFuzzLib.Orm; | ||
namespace Microsoft.OneFuzz.Service.Functions; | ||
|
||
|
||
public class QueueJobResult { | ||
private readonly ILogger _log; | ||
private readonly IOnefuzzContext _context; | ||
|
||
public QueueJobResult(ILogger<QueueJobResult> logTracer, IOnefuzzContext context) { | ||
_log = logTracer; | ||
_context = context; | ||
} | ||
|
||
[Function("QueueJobResult")] | ||
public async Async.Task Run([QueueTrigger("job-result", Connection = "AzureWebJobsStorage")] string msg) { | ||
|
||
var _tasks = _context.TaskOperations; | ||
var _jobs = _context.JobOperations; | ||
|
||
_log.LogInformation("job result: {msg}", msg); | ||
var jr = JsonSerializer.Deserialize<TaskJobResultEntry>(msg, EntityConverter.GetJsonSerializerOptions()).EnsureNotNull($"wrong data {msg}"); | ||
|
||
var task = await _tasks.GetByTaskId(jr.TaskId); | ||
if (task == null) { | ||
_log.LogWarning("invalid {TaskId}", jr.TaskId); | ||
return; | ||
} | ||
|
||
var job = await _jobs.Get(task.JobId); | ||
if (job == null) { | ||
_log.LogWarning("invalid {JobId}", task.JobId); | ||
return; | ||
} | ||
|
||
JobResultData? data = jr.Data; | ||
if (data == null) { | ||
_log.LogWarning($"job result data is empty, throwing out: {jr}"); | ||
return; | ||
} | ||
|
||
var jobResultType = data.Type; | ||
_log.LogInformation($"job result data type: {jobResultType}"); | ||
|
||
Dictionary<string, double> value; | ||
if (jr.Value.Count > 0) { | ||
value = jr.Value; | ||
} else { | ||
_log.LogWarning($"job result data is empty, throwing out: {jr}"); | ||
return; | ||
} | ||
|
||
var jobResult = await _context.JobResultOperations.CreateOrUpdate(job.JobId, jobResultType, value); | ||
if (!jobResult.IsOk) { | ||
_log.LogError("failed to create or update with job result {JobId}", job.JobId); | ||
} | ||
} | ||
} |
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.