% Runprop - worker runtime properties

% Copyright 2005-2017 The MathWorks, Inc.

classdef runprop < handle & hgsetget

    properties
        StorageConstructor
        StorageLocation
        JobLocation
        TaskLocation
        DependencyDirectory
        PerHostDirectory
        HasSharedFilesystem
        AppendPathDependencies
        AppendFileDependencies
        IsFirstTask
        LocalSchedulerName
        FallbackSchedulerName
        DecodeArguments
        ExitOnTaskFinish
        CleanUpDependencyDirOnTaskFinish
        TaskEvaluator
        WarningsCollector
        AttachedFilesPathMap
        OriginalWorkingDirectory
        MATLABDriveEnabled
        EnvironmentVariablesMap
        PortSelectionInformation
    end
    methods
        function obj = runprop()
            obj.DependencyDirectory = [tempname, 'rp', num2str(system_dependent('getpid'))];
            obj.PerHostDirectory = [tempname, 'ph', num2str(system_dependent('getpid'))];
            obj.HasSharedFilesystem = true;
            obj.AppendPathDependencies = true;
            obj.AppendFileDependencies = true;
            obj.IsFirstTask = true;
            obj.LocalSchedulerName = 'parallel.cluster.TaskRunner';
            obj.FallbackSchedulerName = '';
            obj.DecodeArguments = {};
            obj.ExitOnTaskFinish = false;
            obj.CleanUpDependencyDirOnTaskFinish = false;
            obj.TaskEvaluator = parallel.internal.evaluator.EvalcEvaluator( false );
            obj.WarningsCollector = parallel.internal.general.WarningsCollector;
            obj.AttachedFilesPathMap = parallel.internal.apishared.AttachedFileMap();
            obj.OriginalWorkingDirectory = pwd;
            obj.MATLABDriveEnabled = false;
            obj.EnvironmentVariablesMap = containers.Map();
        end
        function d = getAttachedFilesFolder(obj)
            d = fullfile(obj.DependencyDirectory, 'a');
        end
        function d = getPerHostFolder(obj)
            d = obj.PerHostDirectory;
        end
        function d = getPerWorkerFolder(obj)
            d = fullfile(obj.DependencyDirectory, 'w');
        end
    end
end
