cylc/cylc — pull request #1183 by matthewrmshin (2014-10-13 10:45:36+00:00)
Title: Further refactor to the batch systems logic

This is part 2 of the re-factor I started for #1166.

Decouple the task, job submit and job file modules.

Turn `JobFile` into a singleton. Move `cylc.job_submission.jobfile` module up a
level to become `cylc.job_file`. Use a single dict to pass information to the
`write` method for a much cleaner interface.

Rename `cylc.job_submission` package `cylc.batch_sys_handlers`. (It is no
longer just about job submission, but also other interaction with the batch
systems.)

Batch system handler classes are no longer sub-classes of `JobSubmit`. This
allows their interfaces to be much more flexible.

Rename `JobSubmit` to `BatchSysManager` and turn into a singleton. Manage
instances of batch system handlers (so there is no need to create new
instances unnecessarily). Move most batch systems related logic into this
class. Move `cylc.job_submission.job_submit` module up a level to become
`cylc.batch_sys_manager`.

Move most logic in `cylc job-kill`, `cylc job-poll` and `cylc job-submit`
to become methods of `BatchSysManager`.

Allow batch system handler classes to directly format the directives. This
allows each class to have full control of what goes into the job file.

Improve `at` submission command. Use STDIN to write command to `at now`.

Improve `pbs` handler logic. If a directive key contains a space character,
then use the equal sign as the assignment operator. If a directive key does not
contain a space character, use the space character as the assignment character.
Remove the poll output filter logic, as `qstat` already returns non-zero if the
job ID is supplied as an argument and it is no longer in the queue.

Improve pylint scores for the job file and the batch system handler modules.