def test_start_time_attr():
    start_time = datetime.datetime.now()
    jt = JobTemplate()
    jt.start_time = start_time
    assert (int((jt.start_time - POSIX_EPOCH).total_seconds()) == int(
        (start_time - POSIX_EPOCH).total_seconds()))
    print('\nJob template object with start_time: %s' % (start_time))
Beispiel #2
0
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License. 
########################################################################### 
# ___INFO__MARK_END__

from drmaa2 import JobTemplate

if __name__ == '__main__':
    import datetime

    print('Impl. spec. keys: %s' % JobTemplate.get_implementation_specific_keys())
    jt = JobTemplate({'remote_command': '/bin/sleep'})
    print('Initial job template: %s' % jt)
    jt.args = ['200']
    jt.job_environment = {'MY_ENV': 'xyz', 'MY_ENV2': 'xyz2'}
    jt.rerunnable = True
    jt.submit_as_hold = True
    jt.queue_name = 'all.q'
    jt.min_slots = 2
    jt.machine_os = 'LINUX'
    jt.start_time = datetime.datetime.now()
    jt.working_directory = '/tmp'
    print('Current job template: %s' % jt)
    jt.set_impl_spec_key_value('uge_jt_pe', 'xxx')
    print('Impl. spec. key uge_jt_pe is set to: %s' % jt.get_impl_spec_key_value('uge_jt_pe'))
    print('Impl. spec dictionary: %s' % jt.implementation_specific)
    print('Final job template: %s' % jt)