Skip to content

Commit

Permalink
Fixing issue #27
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinoa committed Dec 30, 2021
1 parent bb7cdf0 commit ee3b28b
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ gridway-5.8/src/gwd/gwd
gridway-5.8/src/scheduler/gw_flood_scheduler
gridway-5.8/src/scheduler/gw_sched
.ignore
gridway-5.8/build
gridway-5.8/build_nodebug
2 changes: 1 addition & 1 deletion bin/drm4g
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if __name__ == "__main__":
cmd_name = args['<command>']
argv = [ cmd_name ] + args[ '<args>' ]
if cmd_name in commands_list :
command = getattr( importlib.import_module( "drm4g.commands.%s" % cmd_name ).commands, cmd_name )
command = getattr( __import__( "drm4g.commands.%s" % cmd_name ).commands, cmd_name )
arg = docopt( command.__doc__ , argv = argv )
if arg[ '--debug' ] :
command.console_logger.setLevel(logging.DEBUG)
Expand Down
18 changes: 10 additions & 8 deletions bin/gw_em_mad_drm4g.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@

import sys
import traceback
from argparse import ArgumentParser
from argparse import ArgumentParser,SUPPRESS

from drm4g.core.em_mad import GwEmMad

def main():
parser = ArgumentParser(
description = 'Execution manager MAD',
usage = 'Usage: %(prog)s'
)
parser.add_argument('--version', action='version', version='%(prog)s 0.1')
options, args = parser.parse_args()
parser.add_argument('-v', '--version', action='version', version='0.1')
#workaround for issue
# https://github.com/SantanderMetGroup/DRM4G/issues/27
parser.add_argument('null', nargs="*", type=str, help=SUPPRESS)
parser.parse_args()
try:
GwEmMad().processLine()
except KeyboardInterrupt:
sys.exit(-1)
return -1
except Exception as e:
traceback.print_exc(file=sys.stdout)
sys.exit( 'Caught exception: %s: %s' % (e.__class__, str(e)) )
traceback.print_exc(file=sys.stderr)
return 'Caught exception: %s: %s' % (e.__class__, str(e))

if __name__ == '__main__':
main()
sys.exit(main())
18 changes: 10 additions & 8 deletions bin/gw_im_mad_drm4g.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@

import sys
import traceback
from argparse import ArgumentParser
from argparse import ArgumentParser,SUPPRESS

from drm4g.core.im_mad import GwImMad

def main():
parser = ArgumentParser(
description = 'Information manager MAD',
usage = 'Usage: %(prog)s'
)
parser.add_argument('--version', action='version', version='%(prog)s 0.1')
options, args = parser.parse_args()
parser.add_argument('-v', '--version', action='version', version='0.1')
#workaround for issue
# https://github.com/SantanderMetGroup/DRM4G/issues/27
parser.add_argument('null', nargs="*", type=str, help=SUPPRESS)
parser.parse_args()
try:
GwImMad().processLine()
except KeyboardInterrupt:
sys.exit(-1)
return -1
except Exception as e:
traceback.print_exc(file=sys.stdout)
sys.exit( 'Caught exception: %s: %s' % (e.__class__, str(e)) )
traceback.print_exc(file=sys.stderr)
return 'Caught exception: %s: %s' % (e.__class__, str(e))

if __name__ == '__main__':
main()
sys.exit(main())
18 changes: 10 additions & 8 deletions bin/gw_tm_mad_drm4g.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@

import sys
import traceback
from argparse import ArgumentParser
from argparse import ArgumentParser,SUPPRESS

from drm4g.core.tm_mad import GwTmMad

def main():
parser = ArgumentParser(
description = 'Transfer manager MAD',
usage = 'Usage: %(prog)s'
)
parser.add_argument('--version', action='version', version='%(prog)s 0.1')
options, args = parser.parse_args()
parser.add_argument('-v', '--version', action='version', version='0.1')
#workaround for issue
# https://github.com/SantanderMetGroup/DRM4G/issues/27
parser.add_argument('null', nargs="*", type=str, help=SUPPRESS)
parser.parse_args()
try:
GwTmMad().processLine()
except KeyboardInterrupt:
sys.exit(-1)
return -1
except Exception as e:
traceback.print_exc(file=sys.stdout)
sys.exit( 'Caught exception: %s: %s' % (e.__class__, str(e)) )
traceback.print_exc(file=sys.stderr)
return 'Caught exception: %s: %s' % (e.__class__, str(e))

if __name__ == '__main__':
main()
sys.exit(main())
1 change: 0 additions & 1 deletion drm4g/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,3 @@ def destroy( self ):
console_logger.info( out )
if err :
console_logger.info( err )

1 change: 0 additions & 1 deletion drm4g/commands/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def run( arg ) :
daemon = Daemon()
if not daemon.is_alive() :
raise Exception( 'DRM4G is stopped.' )

elif arg[ 'check' ] :
resource.check_frontends( )
elif arg[ 'create' ] :
Expand Down
2 changes: 1 addition & 1 deletion drm4g/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run( arg ) :
Daemon().status()
agent = Agent()
if agent.is_alive():
agent.status()
agent.status()
except Exception as err :
console_logger.error( str( err ) )

19 changes: 10 additions & 9 deletions drm4g/core/em_mad.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,17 @@ def processLine(self):
while True:
input = sys.stdin.readline().split()
self.logger.debug( ' '.join(input) )
OPERATION = input[0].upper()
if len(input) == 4 and OPERATION in self.methods:
if OPERATION in ( 'FINALIZE', 'INIT', 'SUBMIT', 'RECOVER' ):
self.methods[ OPERATION ]( self, ' '.join(input) )
if len(input)>0:
OPERATION = input[0].upper()
if len(input) == 4 and OPERATION in self.methods:
if OPERATION in ( 'FINALIZE', 'INIT', 'SUBMIT', 'RECOVER' ):
self.methods[ OPERATION ]( self, ' '.join(input) )
else:
pool.add_task( self.methods[ OPERATION ], self, ' '.join(input) )
else:
pool.add_task( self.methods[ OPERATION ], self, ' '.join(input) )
else:
out = 'WRONG COMMAND'
self.message.stdout( out )
self.logger.debug( out )
out = 'WRONG COMMAND'
self.message.stdout( out )
self.logger.debug( out )
except Exception as err:
self.logger.warning( str ( err ) , exc_info=1 )

Expand Down
15 changes: 8 additions & 7 deletions drm4g/core/im_mad.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ def processLine(self):
while True:
input = sys.stdin.readline().split()
self.logger.debug(' '.join(input))
OPERATION = input[0].upper()
if len(input) == 4 and OPERATION in self.methods:
self.methods[OPERATION](self, ' '.join(input))
else:
out = 'WRONG COMMAND'
self.message.stdout(out)
self.logger.debug(out)
if len(input)>0:
OPERATION = input[0].upper()
if len(input) == 4 and OPERATION in self.methods:
self.methods[OPERATION](self, ' '.join(input))
else:
out = 'WRONG COMMAND'
self.message.stdout(out)
self.logger.debug(out)
except Exception as err:
self.logger.warning( str ( err ) , exc_info=1 )

0 comments on commit ee3b28b

Please sign in to comment.