schrodinger.ui.qt.appframework2.jobnames module¶
Functions used for updating job names. update_jobname
is intended for use
outside of AF2.
-
class
schrodinger.ui.qt.appframework2.jobnames.
JobnameType
¶ Bases:
enum.Enum
Constants describing the three categories of job names
-
Standard
= 1¶ The standard job name generated by the panel
-
Modified
= 2¶ The standard job name plus a user-added prefix or suffix (or both)
-
Custom
= 3¶ A user-generated job name that doesn’t contain the standard job name
-
-
schrodinger.ui.qt.appframework2.jobnames.
uniquify
(jobname, jobtype, uniquify_custom=True, omit_one_from_standard=False, name_list=None)¶ Uniquify a job name by adding a trailing integer to ensure that there are no conflicting file names in the current working directory. Standard job names will always have an integer added (e.g. jobname_1, jobname_2, jobname_3). Modified job names (and custom job names if
uniquify_custom
is True) will only have an integer added if necessary (e.g. jobname, jobname_2, jobname_3 - note that there is no “_1”).Parameters: - jobname (basestring) – The job name to uniquify
- jobtype (
JobnameType
) – The job name type, which will determine the uniquifying behavior - uniquify_custom (bool) – Whether we should uniquify custom job name by adding integers to the end. If False, only standard and modified job names will be uniquified.
- omit_one_from_standard (bool) – If True, standard job names will only have an integer added if necessary (i.e. <jobname> instead of <jobname>_1)
- name_list (list of basestring) – Optional list of names to uniquify against. If not given, the name will be compared against the directory listing of the CWD
Returns: The uniquified job name
Return type: basestring
-
schrodinger.ui.qt.appframework2.jobnames.
determine_jobtype
(current_jobname, old_standard_jobname, new_standard_jobname=None, trim_custom=False)¶ Classify the current job name type and generate the new non-unique job name. Note that, as a special case, blank job names will be classified as - and replaced with - the standard job name.
Parameters: - current_jobname (basestring) – The job name to update and classify
- old_standard_jobname (basestring) – The standard job name used for classifying the current job name
- new_standard_jobname (basestring) – The standard job name used for generating the
new job name. If not given,
old_standard_jobname
will be used. - trim_custom (bool) – If True, any trailing uniquifying integer will be removed from custom job names. If False, custom job names will not be modified.
Returns: A tuple of - The new non-unique job name (basestring) - The job name type (
JobnameType
)Return type: tuple
-
schrodinger.ui.qt.appframework2.jobnames.
update_jobname
(current_jobname, standard_jobname, uniquify_custom=True, name_list=None)¶ Update the job name by adding new uniquifying digits at the end
Parameters: - current_jobname (basestring) – The job name to update
- standard_jobname – The standard job name for the panel
- uniquify_custom (bool) – Whether we should uniquify custom job name by adding integers to the end. If False, only standard and modified job names will be uniquified.
- name_list (list of basestring) – Optional list of names to uniquify against. If not given, the name will be compared against the directory listing of the CWD
Returns: The updated job name
Return type: basestring
-
schrodinger.ui.qt.appframework2.jobnames.
get_next_jobname
(jobname, omit_one=False, name_list=None)¶ Given a job name, choose the next available unique job name based on the names of existing files in the current working directory
Parameters: - jobname (basestring) – The job name to uniquify
- omit_one (bool) – If
jobname
is unique by itself, should we omit appending the “_1” - name_list (list of basestring) – Optional list of names to uniquify against. If not given, the name will be compared against the directory listing of the CWD
Returns: The new job name
Return type: basestring
Note: This method will not return <jobname>_1 if a <jobname> file exists. Instead, it will return <jobname>_2 (or whatever the next available integer is). In other words, <jobname> and <jobname>_1 are assumed to be equivalent.