Пример #1
0
def main(argv):
    input_folder = ''
    input_email = ''
    input_mode = 'local'

    try:
        opts, args = getopt.getopt(argv, "hf:e:m:",
                                   ["ffolder=", "eemail=", "mmode="])
    except getopt.GetoptError:
        print 'globus_share.py -f <folder> -e <email> -m <mode>'
        print '<folder>: folder path under the globus share'
        print '<email>: e-mail address to send a web link to the shared folder '
        print '<mode>: local (default) or remote'
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print 'python globus_share.py -f <folder> -e <email> -m <mode>'
            print "python globus_share.py -f test -e [email protected] -m remote"
            print '\t<folder>:folder path under the globus share'
            print '\t<email>:e-mail address to send a link to the shared folder '
            print '\t<mode>:local (default) or remote\n'
            sys.exit()
        elif opt in ("-f", "--ffolder"):
            input_folder = arg
        elif opt in ("-e", "--eemail"):
            input_email = arg
        elif opt in ("-m", "--mmode"):
            input_mode = arg

    input_folder = os.path.normpath(
        input_folder
    ) + os.sep  # will add the trailing slash if it's not already there.

    cmd = gb.share(input_folder, input_email, input_mode)

    if cmd == -1:
        print "ERROR: email is not valid ..."
        print "EXAMPLE: python globus_share.py -f test -e [email protected] -m remote"

    elif cmd == -2:
        print "ERROR: " + input_folder + " does not exists under the Globus Personal Share folder"
        print "EXAMPLE: python globus_share.py -f test -e [email protected] -m remote"
        gb.dm_settings()
    else:
        #os.system(cmd)
        print cmd
        print "Download link sent to: ", input_email
Пример #2
0
def main(argv):
    input_folder = ''
    input_email = ''
    input_mode = 'local'

    try:
        opts, args = getopt.getopt(argv,"hf:e:m:",["ffolder=","eemail=","mmode="])
    except getopt.GetoptError:
        print 'globus_share.py -f <folder> -e <email> -m <mode>'
        print '<folder>: folder path under the globus share'
        print '<email>: e-mail address to send a web link to the shared folder ' 
        print '<mode>: local (default) or remote'
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print 'python globus_share.py -f <folder> -e <email> -m <mode>'
            print "python globus_share.py -f test -e [email protected] -m remote"
            print '\t<folder>:folder path under the globus share'
            print '\t<email>:e-mail address to send a link to the shared folder ' 
            print '\t<mode>:local (default) or remote\n'
            sys.exit()
        elif opt in ("-f", "--ffolder"):
            input_folder = arg
        elif opt in ("-e", "--eemail"):
            input_email = arg
        elif opt in ("-m", "--mmode"):
            input_mode = arg

    input_folder = os.path.normpath(input_folder) + os.sep # will add the trailing slash if it's not already there.
            
    cmd = gb.share(input_folder, input_email, input_mode)

    if cmd == -1: 
        print "ERROR: email is not valid ..."
        print "EXAMPLE: python globus_share.py -f test -e [email protected] -m remote"
        
    elif cmd == -2: 
        print "ERROR: " + input_folder + " does not exists under the Globus Personal Share folder"
        print "EXAMPLE: python globus_share.py -f test -e [email protected] -m remote"
        gb.dm_settings()    
    else:
        #os.system(cmd)
        print cmd
        print "Download link sent to: ", input_email
Пример #3
0
Module containing an example on how to use DMagic to setup an experiment for 
managed data saving by monitoring the raw data collection folder and 
automatically copy to the data processing machine and share to users via Globus.

"""

import pytz
import datetime
import sys

# set ~/globus.ini and ~/scheduling.ini to match your configuration
import dmagic.scheduling as sch
import dmagic.globus as gb

# pring the current Globus settings
gb.dm_settings()

# set the experiment date 
# now = datetime.date.today()

now = datetime.datetime(2014, 10, 18, 10, 10, 30).replace(tzinfo=pytz.timezone('US/Central'))
print "\n\nToday's date: ", now

# find the experiment starting date
exp_start = sch.find_experiment_start(now)
print "Experiment starting date/time: ", exp_start

# create a unique experiment ID using GUP and beamtime request (BR) numbers as: 
# g + GUP# + r + BR#
#exp_id = sch.create_experiment_id(now)
             
Пример #4
0
# #########################################################################
"""
Module containing an example on how to use DMagic to setup and experiment for 
managed data saving and automatic data distribution to users.

"""

import pytz
import datetime

# set ~/globus.ini and ~/scheduling.ini to match your configuration
import dmagic.scheduling as sch
import dmagic.globus as gb

# pring the current Globus settings
gb.dm_settings()

# set the experiment date
# now = datetime.date.today()

now = datetime.datetime(2014, 10, 18, 10, 10,
                        30).replace(tzinfo=pytz.timezone('US/Central'))
print "\n\nToday's date: ", now

# find the experiment starting date
exp_start = sch.find_experiment_start(now)
print "Experiment starting date/time: ", exp_start

# create a unique experiment ID using GUP and beamtime request (BR) numbers as:
# g + GUP# + r + BR#
#exp_id = sch.create_experiment_id(now)