schrodinger.tasks.cmdline module¶
- schrodinger.tasks.cmdline.start_task(task)¶
Wrapper around task.start that runs preprocessing, handles any pre- processing errors or warnings, starts the task, and prints a message if the task fails during start.
- schrodinger.tasks.cmdline.run_task_from_cmdline(TaskClass, args=None)¶
Given a TaskClass, create a task and pass it arguments from the command- line. Arguments take the form of
-foo.bar.x VALUE', where `foo
is a subparam on the input of the task,bar
is a subparam on thefoo
, andx
is a subparam onbar
. Any omitted arguments will take the default value as specified by their corresponding params.- Parameters
args (list[str]) – A list of strings describing the arguments to the task. If
None
, the args will be parsed from the command-line.- Returns
The finished task.
- Return type
TaskClass
- schrodinger.tasks.cmdline.build_task_from_args(TaskClass, args)¶
- schrodinger.tasks.cmdline.run_jobtask_from_cmdline(JobTaskClass, args=None)¶
- schrodinger.tasks.cmdline.build_jobtask_from_args(JobTaskClass, args=None)¶
- schrodinger.tasks.cmdline.write_output(task)¶
Write out each task output subparam of an allowed type to its own file.
- Parameters
task (tasks.AbstractTask) – A task instance with output to be written.
- schrodinger.tasks.cmdline.preprocessing_callback(result)¶
- schrodinger.tasks.cmdline.make_get_job_spec_from_args(TaskClass)¶
Create a get_job_spec_from_args based on the specified task class. Example usage:
get_job_spec_from_args = cmdline.make_get_job_spec_from_args(CounterComboJobTask)
Note: task.job_config will not be populated to match the cmdline job flags
- Parameters
TaskClass – the ComboJobTask class to run under jobcontrol
- Returns
a get_job_spec_from_args function
- schrodinger.tasks.cmdline.make_main(task_source: Union[type, Dict[str, type]], auto_write_output: bool = False) Callable ¶
Create a main function for running any combo task directly from the command line in-process (no job control). Example usage:
main = cmdline.make_main(CounterComboJobTask) if __name__ == '__main__': main()
Alternatively, a dictionary of subparser names to task classes can be supplied, giving users the option to pick between different tasks to run:
task_dict = { 'scaffold-search': ScaffoldSearchTask, 'grafting': GraftingTask, } main = cmdline.make_main(task_dict) if __name__ == '__main__': main()
Note
A subparser is automatically created for each task in the dictionary. They are named using the keys of the dictionary.
- Parameters
task_source – the source of combo task class(es) to use. Can be either a single combo task class or a dictionary mapping subparser names to task classes.
auto_write_output – Whether to automatically write the task output to files if possible. Turn off output writing if the task already writes output to files in the backend.
- Returns
a main function