schrodinger.tasks.cmdline module¶
- schrodinger.tasks.cmdline.make_main(task_source: Union[type, Dict[str, type]], customizer_source: Union[Callable[[Dict[schrodinger.models.parameters.CompoundParam, schrodinger.tasks.cmdline._Argument]], None], Dict[str, Callable[[Dict[schrodinger.models.parameters.CompoundParam, schrodinger.tasks.cmdline._Argument]], None]]] = None, 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.
customizer_source – An optional source of customizer functions to use when creating the argument parser. Can be either a single customizer function or a dictionary mapping subparser names to customizers.
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
- schrodinger.tasks.cmdline.make_get_job_spec_from_args(TaskClass, customizer_source: Union[Callable[[Dict[schrodinger.models.parameters.CompoundParam, schrodinger.tasks.cmdline._Argument]], None], Dict[str, Callable[[Dict[schrodinger.models.parameters.CompoundParam, schrodinger.tasks.cmdline._Argument]], None]]] = None)¶
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
customizer_source – An optional source of customizer functions to use when creating the argument parser. Can be either a single customizer function or a dictionary mapping subparser names to customizers. This should be the same customizer function used in the corresponding make_main call.
- Returns
a get_job_spec_from_args function