コード例 #1
0
def generate_makefile_from_yaml(args):

    bpy = skel_bpy.skel_bpy(args.yamlfile)

    template_file_name = "~/.skel/templates/Makefile.tmpl"
    outfilename = "Makefile"

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists(outfilename) and not args.force:
        print("%s exists, aborting. Delete the file or use -f to overwrite." %
              outfilename)
        return 999

    skel_file = open(outfilename, 'w')

    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open(os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    t.bpy = bpy
    t.project = args.project
    t.bpfile = args.bpfile
    t.noxml = args.noxml
    skel_file.write(str(t))
コード例 #2
0
ファイル: skel_makefile.py プロジェクト: Dumbear/ADIOS
def generate_makefile_from_yaml (args):

    bpy = skel_bpy.skel_bpy (args.yamlfile)

    template_file_name = "~/.skel/templates/Makefile.tmpl"
    outfilename = "Makefile"

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists (outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open (outfilename, 'w')


    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    t.bpy = bpy
    t.project = args.project
    t.bpfile = args.bpfile
    t.noxml = args.noxml
    skel_file.write (str(t) )
コード例 #3
0
ファイル: skel_submit.py プロジェクト: icedwater/ADIOS
def generate_submit_scripts_from_yaml (args):
    #print "Generating submission script using yaml file"

    bpy = skel_bpy.skel_bpy (args.yamlfile)

    outfilename = "submit.pbs"
    template_file_name = "~/.skel/templates/submit_sith.tmpl"

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists (outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open (outfilename, 'w')

    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    settings = skel_settings.skel_settings()

    t.bpy = bpy
    t.project = args.project
    t.target = settings.get_submit_target()
    t.account = settings.get_account()
    t.job_name = "skel_%s_%d" % (args.project, bpy.get_num_procs() )
    t.walltime = "1:00:00"
    t.iteration_count = 1
    t.executable = "%s_skel_%s" % (t.project, bpy.get_group_name() )

    skel_file.write (str(t) )
コード例 #4
0
ファイル: skel_replay.py プロジェクト: icedwater/ADIOS
def do_replay_from_yaml (args):
    print "Replaying using %s" % args.yamlfile

    replay_file_name = "%s_replay.sh" % args.project
    replay_file = open (replay_file_name, "w")
    bpy = skel_bpy.skel_bpy (args.yamlfile)

    # Generate replay_yaml.sh shell script
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser("~/.skel/templates/replay_yaml.tmpl"), 'r')
    t = Template(file=template_file)
    t.bpy = bpy

    # No, I don't like these either.
    t.yamlfile = args.yamlfile
    t.project = args.project
    t.force = args.force

    replay_file.write (str(t) )

    replay_file.close()

    # Adjust the permissions of the replay script to make it runnable by user
    os.chmod (replay_file_name, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR)

    # Run it
    subprocess.check_call ("./%s" % replay_file_name)
コード例 #5
0
def do_replay_from_yaml (args):
    print "Replaying using %s" % args.yamlfile

    replay_file_name = "%s_replay.sh" % args.project
    replay_file = open (replay_file_name, "w")
    bpy = skel_bpy.skel_bpy (args.yamlfile)

    # Generate replay_yaml.sh shell script
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser("~/.skel/templates/replay_yaml.tmpl"), 'r')
    t = Template(file=template_file)
    t.bpy = bpy
    t.noxml = args.noxml

    # No, I don't like these either.
    t.yamlfile = args.yamlfile
    t.project = args.project
    t.force = args.force

    replay_file.write (str(t) )

    replay_file.close()

    # Adjust the permissions of the replay script to make it runnable by user
    os.chmod (replay_file_name, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR)

    # Run it
    subprocess.check_call ("./%s" % replay_file_name)
コード例 #6
0
ファイル: skel_submit.py プロジェクト: zeneofa/ADIOS
def generate_submit_scripts_from_yaml (args):
    #print "Generating submission script using yaml file"

    bpy = skel_bpy.skel_bpy (args.yamlfile)

    outfilename = "submit.pbs"
    template_file_name = "~/.skel/templates/submit_sith.tmpl"

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists (outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open (outfilename, 'w')

    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    settings = skel_settings.skel_settings()

    t.bpy = bpy
    t.project = args.project
    t.target = settings.get_submit_target()
    t.account = settings.get_account()
    t.job_name = "skel_%s_%d" % (args.project, bpy.get_num_procs() )
    t.walltime = "1:00:00"
    t.iteration_count = 1
    t.executable = "%s_skel_%s" % (t.project, bpy.get_group_name() )

    skel_file.write (str(t) )
コード例 #7
0
def create_from_yaml(project, args):
    #print "using yaml file"

    outfilename = project + '_skel.xml'

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists(outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open(outfilename, 'w')

    bpy = skel_bpy.skel_bpy(args.yamlfile)

    # Okay, it's time to try out Cheetah.
    from Cheetah.Template import Template
    template_file = open(os.path.expanduser("~/.skel/templates/xml.tmpl"), 'r')
    t = Template(file=template_file)
    t.bpy = bpy
    skel_file.write(str(t))
コード例 #8
0
ファイル: skel_xml.py プロジェクト: icedwater/ADIOS
def create_from_yaml (project,args):
    #print "using yaml file"

    outfilename = project + '_skel.xml'

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists (outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open (outfilename, 'w')

    bpy = skel_bpy.skel_bpy (args.yamlfile)


    # Okay, it's time to try out Cheetah.
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser("~/.skel/templates/xml.tmpl"), 'r')
    t = Template(file=template_file)
    t.bpy = bpy
    skel_file.write (str(t) )
コード例 #9
0
def create_source_from_yaml(args, config):
    #print "Using yaml file"

    # Determine the target language
    if config.host_language == "C" or config.host_language == "c":
        filetype = ".c"
        template_file_name = "~/.skel/templates/source_write_c.tmpl"
    else:
        filetype = ".f90"
        template_file_name = "~/.skel/templates/source_write_fortran.tmpl"

    bpy = skel_bpy.skel_bpy(args.yamlfile)

    # Determine outfile name

    #print bpy.get_group_name()

    extension = '_skel_' + bpy.get_group_name()
    outfilename = args.project + extension + filetype

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists(outfilename) and not args.force:
        print("%s exists, aborting. Delete the file or use -f to overwrite." %
              outfilename)
        return 999

    skel_file = open(outfilename, 'w')

    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open(os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    t.bpy = bpy
    t.project = args.project
    t.noxml = args.noxml
    skel_file.write(str(t))
コード例 #10
0
ファイル: skel_source.py プロジェクト: Dumbear/ADIOS
def create_source_from_yaml (args, config):
    #print "Using yaml file"

    # Determine the target language
    if config.host_language == "C" or config.host_language =="c":
        filetype = ".c"
        template_file_name = "~/.skel/templates/source_write_c.tmpl"
    else:
        filetype = ".f90"
        template_file_name = "~/.skel/templates/source_write_fortran.tmpl"

    bpy = skel_bpy.skel_bpy (args.yamlfile)

    # Determine outfile name

    #print bpy.get_group_name()

    extension = '_skel_' + bpy.get_group_name()
    outfilename = args.project + extension + filetype

    # Only proceed if outfilename does not already exist, or if -f was used
    if os.path.exists (outfilename) and not args.force:
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
        return 999

    skel_file = open (outfilename, 'w')


    # Now for the Cheetah magic:
    from Cheetah.Template import Template
    template_file = open (os.path.expanduser(template_file_name), 'r')
    t = Template(file=template_file)

    t.bpy = bpy
    t.project = args.project
    t.noxml = args.noxml
    skel_file.write (str(t) )