Skip to content

Check if function is necessary #550

Description

@olaals

Describe the improvement you would like to see

Recently sara was refactored to submit whole argo workflows (with all analysis steps) upfront instead of submitting one after another. This function is called on anonymizer complete, and i suspect it might not be necessary anymore. Needs to be looked into if it can be removed.

    private async Task RewireNextWorkflowIfThermalReading(
        Workflow workflow,
        AnonymizerResult? result
    )
    {
        var nextWorkflow = await context
            .Workflows.Include(w => w.InputBlobStorageLocations)
            .Where(w =>
                w.AnalysisRunId == workflow.AnalysisRunId && w.StepNumber > workflow.StepNumber
            )
            .OrderBy(w => w.StepNumber)
            .FirstOrDefaultAsync();


        if (nextWorkflow is null || nextWorkflow.WorkflowType != "thermal-reading")
        {
            return;
        }


        if (result?.PreProcessedBlobStorageLocation is not { } preProcessed)
        {
            logger.LogError(
                "Anonymizer workflow {WorkflowId} is followed by thermal-reading workflow "
                    + "{NextWorkflowId} but result is missing preProcessedBlobStorageLocation — "
                    + "thermal-reading will run against the raw input.",
                workflow.Id,
                nextWorkflow.Id
            );
            return;
        }


        nextWorkflow.InputBlobStorageLocations.Clear();
        nextWorkflow.InputBlobStorageLocations.Add(preProcessed);
        await context.SaveChangesAsync();


        logger.LogInformation(
            "Rewired thermal-reading workflow {NextWorkflowId} inputs to anonymizer's preProcessed TIFF",
            nextWorkflow.Id
        );
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

improvementImprovement to existing functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions