#Below you can find a list of commands that populate the default settings ("config") when init() is called. To adjust a particular setting for just one run, you can copy the corresponding line to your script and modify it as you wish. Changing values in this file will have a global effect on all future PLAMS runs



#==== General defaults =====================================================
#Enable preview mode: no actual calculations are run, only inputs and runscripts are prepared
config.preview = False

#Defines a unit of time which is used whenever some action needs to be repeated until a certain condition is met.
config.sleepstep = 5

#Defines what happens when results of failed/crashed job are accessed
#If False, an exception is thrown
#If True, PLAMS will try to obtain the requested results anyway and inform you about it in the log (level 3)
config.ignore_failure = True

#If set to True, all threads started by JobRunner are daemon threads.
#Daemon threads are terminated when the main thread finishes and hence allow immediate end of the parallel script when Ctrl-C is pressed
config.daemon_threads = True

#If set to True, the entire main working folder is deleted at the end of script
config.erase_workdir = False



#==== JobManager defaults ==================================================
#(Below is a template for a default settings object for JobManager. It is not the same as the default JobManager. The default JobManager instance is stored as config.default_jobmanager)

#When two or more jobs have the same name, all the jobs apart from the first one are renamed to [jobname].002 ([jobname].003 etc.)
# The number here defines how many digits are used for that counter
config.jobmanager.counter_len = 3

#Defines the hashing method used for testing if some job was previously run
#Currently supported values are: 'input', 'runscript', 'input+runscript' and False/None
config.jobmanager.hashing = 'input'

#Removes all empty subdirectories in the main working folder at the end of the script
config.jobmanager.remove_empty_directories = True



#==== Job defaults =========================================================

#After a job execution is finished, pickle the whole job object to [jobname].dill
config.job.pickle = True
config.job.pickle_protocol = -1

#Define which files produced by the executed job should be kept on the disk
#See the documentation (Components overview -> Results -> Cleaning job folder) for details and possible values
config.job.keep = 'all'
config.job.save = 'all'

#The first line of all produced runscripts
config.job.runscript.shebang = '#!/bin/sh'

#If set to True, the standard output redirection is handled by your operating system (by using '>[jobname].out' in the runscript)
#If False, it is handled by native Python mechanism
#(set to True if you want to peek an output of a job submitted to a queue on a cluster, while the job is running)
config.job.runscript.stdout_redirect = False

#When files are imported into job's directory by rerun prevention, they can be either copied or hardlinked
#Set to True for hardlinks, False for copying
#On Windows this has no effect, files are always copied.
config.job.link_files = True



#==== Log defaults =========================================================

#Verbosity of log messages: 0:none  1:minimal  3:normal  5:verbose  7:extremely talkative

#Verbosity of the log printed to .log file in the main working folder
config.log.file = 5
#Verbosity of the log printed to the standard output
config.log.stdout = 3
#Print time for each log event
config.log.time = True
#Print date for each log event
config.log.date = True



#==== Subprocess retry =====================================================

#All the subprocess.run() calls in PLAMS are wrapped with the saferun() function which will retry the run() call if OSError was raised. This is done mainly to deal with BlockingIOError no 11 (resource temporarily unavailable) in case of large number of run() calls in a short period of time (for example, when a large MultiJob submits its long list of children to a job scheduler). The parameters below define the number of attempts to be made for each run() call and the delay between them.

config.saferun.repeat = 10
config.saferun.delay = 1



#==== Default JobRunner ====================================================

from .jobrunner import JobRunner
#Use a local serial JobRunner as a default
config.default_jobrunner = JobRunner(parallel=False)
