IMP  2.0.1
The Integrative Modeling Platform
filebased_loader.py
1 ##
2 ## The Inferential Structure Determination (ISD) software library
3 ##
4 ## Authors: Michael Habeck and Wolfgang Rieping,
5 ##
6 ## Copyright (C) Michael Habeck and Wolfgang Rieping
7 ##
8 ## All rights reserved.
9 ##
10 ## NO WARRANTY. This library is provided 'as is' without warranty of any
11 ## kind, express or implied, including, but not limited to the implied
12 ## warranties of merchantability and fitness for a particular purpose or
13 ## a warranty of non-infringement.
14 ##
15 ## Distribution of substantively modified versions of this module is
16 ## prohibited without the explicit permission of the copyright holders.
17 ##
18 
19 if __name__ == '__main__':
20 
21  import os, sys, time, cPickle
22 
23  import IMP.isd.FileBasedGrid as FileBasedGrid
24  import IMP.isd.logfile as logfile
25 
26  import shared_functions as sf
27 
28  log_output = True
29 
30  f = open(sys.argv[1])
31  init_data = cPickle.load(f)
32  f.close()
33 
34  temp_path = init_data['temp_path']
35 
36  os.environ['ISD_ROOT'] = temp_path
37 
38  if not temp_path in sys.path:
39  sys.path.insert(0, temp_path)
40 
41  os.nice(init_data['niceness'])
42 
43  kill_on_error = not init_data['display']
44  signal_file = '%s/kill' % temp_path
45 
46  parent_tid = init_data['parent_tid']
47  tid = init_data['tid']
48  debug = init_data['debug']
49 
50  print 'Tid=%d, nice=%d, debug=%s, temp=%s' % (tid, init_data['niceness'],
51  str(debug), temp_path)
52 
53  if log_output:
54  filename = temp_path + '/%d.log' % tid
55  log = logfile.logfile(filename)
56  if debug:
57  os.dup2(sys.stdout.fileno(),log.fileno())
58  else:
59  sys.stdout = log
60 
61  handler = FileBasedGrid.FileBasedRemoteObjectHandler(
62  kill_on_error, signal_file, temp_path, parent_tid, tid,
63  debug, init_data['nfs_care'])
64 
65  handler.start()