<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import json <EOL> from . import parse_args <EOL> import jip <EOL> import jip . jobs <EOL> import jip . tools <EOL> import jip . options <EOL> import jip . profiles <EOL> import jip . pipelines <EOL> from jip . logger import getLogger <EOL> log = getLogger ( '<STR_LIT>' ) <EOL> class sorted_dict ( dict ) : <EOL> def items ( self ) : <EOL> ks = self . keys ( ) <EOL> sorted_keys = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:time>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" <EOL> ] <EOL> for k in [ x for x in sorted_keys if x in ks ] : <EOL> yield k , self [ k ] <EOL> def iteritems ( self ) : <EOL> return self . items ( ) <EOL> def main ( argv = None ) : <EOL> args = parse_args ( __doc__ , argv = argv ) <EOL> script_file = args [ "<STR_LIT>" ] <EOL> script_args = args [ "<STR_LIT>" ] <EOL> try : <EOL> script = jip . find ( script_file ) <EOL> except LookupError , e : <EOL> print >> sys . stderr , str ( e ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> jip . options . _check_required = False <EOL> profile = jip . profiles . get ( name = '<STR_LIT:default>' ) <EOL> jobs = jip . jobs . create_jobs ( script , args = script_args , <EOL> profile = profile ) <EOL> specs = { } <EOL> default_env = os . environ <EOL> env_exckludes = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> for j in jobs : <EOL> job_env = { } <EOL> for k , v in j . env . iteritems ( ) : <EOL> if not k in env_exckludes and v and v != default_env . get ( k , None ) : <EOL> job_env [ k ] = v <EOL> spec = sorted_dict ( { <EOL> "<STR_LIT>" : j . threads , <EOL> "<STR_LIT>" : j . max_memory , <EOL> "<STR_LIT>" : j . queue , <EOL> "<STR_LIT>" : j . priority , <EOL> "<STR_LIT:time>" : j . max_time , <EOL> "<STR_LIT>" : j . account , <EOL> "<STR_LIT>" : j . extra , <EOL> "<STR_LIT>" : job_env <EOL> } ) <EOL> specs [ j . name ] = spec <EOL> print json . dumps ( { "<STR_LIT>" : specs } , indent = <NUM_LIT:4> , sort_keys = False ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
