Exemple #1
0
def init_db():
    connection = SQLEngine.connect()
    context = MigrationContext.configure(connection)
    current_revision = context.get_current_revision()
    logger.boot('Database revision: %s', current_revision)
    if current_revision is None:
        DataBase.metadata.create_all(SQLEngine)

    config = Config(ALEMBIC_CONFIG)
    script = ScriptDirectory.from_config(config)
    head_revision = script.get_current_head()
    if current_revision is None or current_revision != head_revision:
        logger.boot('Upgrading database to version %s.', head_revision)
        command.upgrade(config, 'head')
        from config import Option
        session = Session()
        options = session.query(Option).first()
        if options is None:
            options = Option()
        options.version = head_revision
        session.add(options)
        from pulse import Pulse
        pulse = session.query(Pulse).first()
        if pulse is None:
            pulse = Pulse()
        session.add(pulse)
        session.commit()
Exemple #2
0
class CMConfig(BaseConfig):
    log_level = Option('INFO')
    listen_addr = Option('')
    listen_port = IntOption(51235)
    cadir = Option('/etc/pki/certmaster/ca')
    cert_dir = Option('/etc/pki/certmaster')
    certroot =  Option('/var/lib/certmaster/certmaster/certs')
    csrroot = Option('/var/lib/certmaster/certmaster/csrs')
    cert_extension = Option('cert')
    autosign = BoolOption(False)
    sync_certs = BoolOption(False)
    peering = BoolOption(True)
    peerroot =  Option('/var/lib/certmaster/peers')
Exemple #3
0
        clustering_loss = criterion.compute(pairwise_distances, labels, opt,
                                            global_step)

        return clustering_loss


if __name__ == "__main__":
    import warnings
    import time

    warnings.filterwarnings("ignore")
    print("hello")
    torch.save(torch.rand(3, 3), "/home/wyt/1_lrz/8-3/observe/step.pt")
    os.environ["CUDA_VISIBLE_DEVICES"] = "6"
    ml = metric_loss()
    opt = Option()
    # f = tl.cudafy(Variable(torch.randn(128, 50),requires_grad=True))[0]
    # l=tl.cudafy(torch.cat((torch.ones([100]),torch.zeros([28])),0))[0]
    # torch.save(f,"/home/wyt/1_lrz/test/f.pt")
    # torch.save(l, "/home/wyt/1_lrz/test/l.pt")
    f = torch.load("/home/wyt/1_lrz/test/f.pt")
    l = torch.load("/home/wyt/1_lrz/test/l.pt")
    # ans = ml.pairwise_distance()
    # t1=time.time()
    loss, num_class = ml.cluster_loss(opt, f, l)
    # t2=time.time()
    print("loss:", loss)
    print("num_class:", num_class)
    # print("ttime:",t2-t1," seconds")
    # print(ans)
    # centroid_ids = torch.tensor([0, 2, 3])
Exemple #4
0
from config import Option
from arguments_configurator import ArgsConfigurator

opts = []
opts.append(Option('host', 'host', 'h', False, 'localhost', 'help...'))
opts.append(Option('vcip', 'vcip', 'v', True, True, 'help...'))
config_manager = ArgsConfigurator(opts)
res = config_manager.config
print '====='
Exemple #5
0
class FuncdConfig(BaseConfig):
    log_level = Option('INFO')
    acl_dir = Option('/etc/func/minion-acl.d')
    certmaster_overrides_acls = BoolOption(True)
Exemple #6
0
class MinionConfig(BaseConfig):
    log_level = Option('INFO')
    certmaster = Option('certmaster')
    certmaster_port = IntOption(51235)
    cert_dir = Option('/etc/pki/certmaster')
from config import Option
from environment_configurator import EnvironmentConfigurator

opts = []
opts.append(Option('Virgo Directory', 'virgoDir', 'h', False, 'localhost', 'help...'))
opts.append(Option('Virgo Dir 1', 'virgoDir1', 'h', False, 'localhost', 'help...'))
opts.append(Option('NVM bin', 'NVM_BIN', 'h', False, 'localhost', 'help...'))
config_manager = EnvironmentConfigurator(opts)
res = config_manager.config
print '====='
print res