soprano.hpc.submitter.castep#
Definition of CastepSubmitter class.
A basic “rolling” submitter for Castep calculations, grabbing from one folder and depositing results in another.
Classes
|
Initialize the Submitter object |
- class soprano.hpc.submitter.castep.CastepSubmitter(name, queue, submit_script, max_jobs=4, check_time=10, max_time=3600, temp_folder=None, remote_workdir=None, remote_getfiles=['*.*'], ssh_timeout=1.0, continuation=False)[source]#
Bases:
Submitter
Initialize the Submitter object
Args:name (str): name to be used for this Submitter (two Submitterswith the same name can’t be launched in the sameworking directory)queue (QueueInterface): object describing the properties of theinterface to the queue system in usesubmit_script (str): text of the script to use when submitting ajob to the queue. All tags of the form <name>will be replaced with the job’s name, and allsimilar tags of the form <[arg]> will bereplaced if the argument name is present inthe job’s args dictionarymax_jobs (Optional[int]): maximum number of jobs to submit at agiven time. Default is 4check_time (Optional[float]): time in seconds between consecutivechecks for the queue status andattempts to submit new jobs. Defaultis 10max_time (Optional[float]): time in seconds the Submitter will runfor before shutting down. If set tozero the thread won’t stop untilkilled with Submitter.stop.temp_folder (Optional[str]): where to store the temporary foldersfor the calculations. By default it’sthe current folder.remote_workdir (Optional[str]): if present, uses a directory on aremote machine by logging in viaSSH. Must be in the format<host>:<path/to/directory>.Host must be defined in the user’s~/.ssh/config file - check thedocs for RemoteTarget for moreinformation. It is possible toomit the colon and directory, thatwill use the home directory of thegiven folder; that is HEAVILYDISCOURAGED though. Best practicewould be to create an emptydirectory on the remote machineand use that, to avoid accidentaloverwriting/deleting of importantfiles.remote_getfiles (Optional[list(str)]): list of files to bedownloaded from the remotecopy of the job’s temporarydirectory. By default, allof them. Can be a listusing specific names,wildcards etc. Filenamescan also use theplaceholder {name} tosignify the job name, aswell as any other elementfrom the arguments.ssh_timeout (Optional[float]): connection timeout in seconds(default is 1 second)continuation (Optional[bool]): if True, when the Submitter isstopped it will not terminate thecurrent jobs; rather, it will storethe list in a pickle file.If the submitter is ran from thesame folder then it will “pick upfrom where it left” and tryrecovering those jobs, thenrestart. If one wishes foradditional values to be saved andrestored, the save_state andload_state methods need to bedefined.- _main_loop()#
Main loop run as separate thread. Should not be edited when inheriting from the class
- _putjob_remote(njob)#
Copy the files generated for a job to a remote work directory
- add_signal(command, callback)#
Add a signal listener to this submitter. Unix systems only allow for up to TWO user-defined signals to be specified.
Args:command (str): command that should be used to call this signal.This would be used as:python -m soprano.hpc.submitter <command> <file>and will trigger the callback’s executioncallback (function<self> => None): method of the user definedSubmitter class to use as a callback when thegiven signal is sent. Should accept and returnnothing.
- check_job(job_id, name, args, folder)#
Checks if given job is complete or not
- load_state(loaded)#
Replace attributes from loaded data in dictionary form
- remove_signal(command)#
Remove a previously defined custom signal by its assigned command.
Args:command (str): command assigned to the signal handler to remove.
- save_state()#
Return a dictionary containing serialisable data to be saved from one run to the next
- set_parameters(folder_in, folder_out, castep_command, castep_path=None, copy_extensions=['.castep'], pspot_files=[], dryrun_test=False)[source]#
Set the parameters of the CASTEP Submitter
Args:folder_in (str): path of the folder to extract cell files fromfolder_out (str): path of the folder where the results will besavedcastep_command (str): command used to call the CASTEP executableon this systemcastep_path (Optional[str]): folder where the CASTEP executable islocated (if not part of the systemPATH)pspot_files (Optional[list[str]]): additional pseudopotentialfiles to be copied in the inputtemporary folderscopy_extensions (Optional[list[str]]): extensions of output filesto copy to the outputfolder (by default only.castep file)dryrun_test (Optional[bool]): run a dryrun test on files beforeactually running the calculation.Off by default.
- static stop(fname, subname)#
Stop Submitter process from filename and name, return False if failed