% BatchJobConstants - Helper methods used to tag and identify batch jobs

% Copyright 2020 The MathWorks, Inc.

classdef BatchJobConstants
    
    properties (Constant)
        BatchJobOnFunctionTaskName = 'parallel.internal.cluster.executeFunction'
        BatchJobOnScriptTaskName = 'parallel.internal.cluster.executeScript'
        BatchJobTag = 'Created_by_batch'
    end
    
    methods (Static)
        function tf = isBatchFunctionJob(firstTaskFunction, apiTag)
            import parallel.internal.cluster.BatchJobConstants
            tf = strcmp(firstTaskFunction, BatchJobConstants.BatchJobOnFunctionTaskName) ...
                && strcmp(apiTag, BatchJobConstants.BatchJobTag);
        end
        
        function tf = isBatchScriptJob(firstTaskFunction, apiTag)
            import parallel.internal.cluster.BatchJobConstants
            tf = strcmp(firstTaskFunction, BatchJobConstants.BatchJobOnScriptTaskName) ...
                && strcmp(apiTag, BatchJobConstants.BatchJobTag);
        end
    end
end
