Exemplo n.º 1
0
def main():
    u"""Main method

    Create session.
    Excute subcommand.
    """
    # Import
    import socket
    import getpass
    import sys
    from pysphere import VIApiException, VIServer
    import argument

    # Get argument
    args = argument.args()
    s = VIServer()

    # Set information
    host = args.host if args.host else raw_input('Host> ')
    user = args.user if args.user else raw_input('User> ')
    passwd = args.passwd if args.passwd else getpass.getpass('Password> ')
    try:
        print 'Connecting...'
        s.connect(host, user, passwd)

        # Execute function
        args.func(args, s)
    except socket.error:
        print >> sys.stderr, "Cannot connected."
    except VIApiException:
        print >> sys.stderr, "Incorrect user name or password."
    except Exception, e:
        print >> sys.stderr, e.message
Exemplo n.º 2
0
 def __init__(self, input, args=argument.args()):
     self.input = input
     self.args = args
     self.latestInput = input
     self.inputLevels = kMaximumIndentation * [None]
     self.outputLevels = kMaximumIndentation * [None]
     self.inputLevels[0] = input
     self.currentBranch = 0
     self.justBranched = False
     self.justStopped = False
     self.branchRunFlag = True
     self.branchRunFlagLevels = kMaximumIndentation * [True]
     self.branchDependencyLevels = kMaximumIndentation * [None]
     self.i = 0
     self.jobIndex = 0
     self.subJobIndex = 0
     self.runMode = True
     self.printFlag = True
     self.wmParams = {}
     self.defaultWmParams = {}
     self.outputCheckMode = False
     self.outputCheckModeCount = False
     if '--mock' in sys.argv or self.args.get("mock"):
         self.runMode = False
     if '--noPrint' in sys.argv or self.args.get("noPrint"):
         self.printFlag = False
     if '--outputCheck' in sys.argv or self.args.get("outputCheck"):
         self.runMode = False
         self.outputCheckMode = True
         if '--count' in sys.argv or args.get("count"):
             self.outputCheckModeCount = True
Exemplo n.º 3
0
def main():
    u"""Main method

    Create session.
    Excute subcommand.
    """
    import getpass
    import socket
    import sys

    import argument
    import XenAPI

    # Get argument
    args = argument.args()

    # Set URL, Username, Password
    url = args.url if args.url else raw_input('URL> ')
    user = args.user if args.user else raw_input('User> ')
    passwd = args.passwd if args.passwd else getpass.getpass()

    try:
        print 'Making session...'
        session = XenAPI.Session(url)
    except socket.error:
        print >> sys.stderr, 'Not found server.'
        sys.exit(1)

    try:
        print 'Connecting...'
        session.login_with_password(user, passwd)

        #Execute function
        args.func(args, session)
    except Exception, e:
        print >> sys.stderr, e.message
        return y


if __name__ == '__main__':
    from argument import args
    import random

    def seed_torch(seed):
        random.seed(seed)
        os.environ['PYTHONHASHSEED'] = str(seed)
        np.random.seed(seed)
        tr.manual_seed(seed)
        tr.cuda.manual_seed(seed)
        tr.backends.cudnn.deterministic = True

    args = args()
    args.n_way = 10

    for j in range(40, 60):
        args.lr = 1e-4
        args.save_name = 'Anchor_MSD_{}'.format(j)
        Train = main(args)
        Train.train_imb()

    # for i in range(4):
    #     args.lr = 1e-4
    #     args.visual = True
    #     args.save_name = 'ACB_GCN_MSD_visual_{}'.format(i)
    #     Train = main(args)
    #     Train.train_imb()