org.apache.ignite.Ignition.ignite()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.ignite.Ignition.ignite()方法的一些代码示例,展示了Ignition.ignite()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignition.ignite()方法的具体详情如下:
包路径:org.apache.ignite.Ignition
类名称:Ignition
方法名:ignite

Ignition.ignite介绍

[英]Gets an instance of default no-name grid. Note that caller of this method should not assume that it will return the same instance every time.

This method is identical to G.grid(null) apply.
[中]获取默认无名称网格的实例。请注意,此方法的调用方不应假定每次都返回相同的实例。
此方法与G.grid(null)apply相同。

代码示例

代码示例来源:origin: apache/ignite

/**
 * Formats "TF_CLUSTER" variable to be passed into user script.
 *
 * @return Formatted "TF_CLUSTER" variable to be passed into user script.
 */
private String formatTfClusterVar() {
  return clusterSpec.format(Ignition.ignite());
}

代码示例来源:origin: apache/ignite

/**
 * Formats "TF_CHIEF_SERVER" variable to be passed into user script.
 *
 * @return Formatted "TF_CHIEF_SERVER" variable to be passed into user script.
 */
private String formatTfChiefServerVar() {
  List<TensorFlowServerAddressSpec> tasks = clusterSpec.getJobs().get(TensorFlowClusterResolver.CHIEF_JOB_NAME);
  if (tasks == null || tasks.size() != 1)
    throw new IllegalStateException("TensorFlow cluster specification should contain exactly one chief task");
  TensorFlowServerAddressSpec addrSpec = tasks.iterator().next();
  return "grpc://" + addrSpec.format(Ignition.ignite());
}

代码示例来源:origin: apache/ignite

/**
 * Constructs a new instance of model storage inference model builder.
 *
 * @param path Path to the directory or file.
 */
public ModelStorageModelReader(String path) {
  this(path, () -> new ModelStorageFactory().getModelStorage(Ignition.ignite()));
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  @Override public ProcessBuilder get() {
    ProcessBuilder pythonProcBuilder = super.get();

    Ignite ignite = Ignition.ignite();
    ClusterNode locNode = ignite.cluster().localNode();

    Integer port = locNode.attribute(ClientListenerProcessor.CLIENT_LISTENER_PORT);

    Map<String, String> env = pythonProcBuilder.environment();
    env.put(ENV_PREFIX + "HOST", "localhost");

    if (port != null)
      env.put(ENV_PREFIX + "PORT", String.valueOf(port));

    if (loc != null)
      env.put(ENV_PREFIX + "LOCAL", String.valueOf(loc));

    return pythonProcBuilder;
  }
}

代码示例来源:origin: apache/ignite

ignite = Ignition.ignite(igniteInstanceName == null ? null : igniteInstanceName.toString());

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  @Override public R call() throws Exception {
    Ignite ignite = Ignition.ignite(id);
    return job.call(ignite);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void onApplicationEvent(ContextRefreshedEvent event) {
  if (ignite == null) {
    if (cfgPath != null && cfg != null) {
      throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
        "provided. Set only one of these properties if you need to start a Ignite node inside of " +
        "SpringCacheManager. If you already have a node running, omit both of them and set" +
        "'igniteInstanceName' property.");
    }
    try {
      if (cfgPath != null) {
        ignite = IgniteSpring.start(cfgPath, springCtx);
      }
      else if (cfg != null)
        ignite = IgniteSpring.start(cfg, springCtx);
      else
        ignite = Ignition.ignite(igniteInstanceName);
    }
    catch (IgniteCheckedException e) {
      throw U.convertException(e);
    }
  }
}

代码示例来源:origin: apache/ignite

@Override public void onLifecycleEvent(LifecycleEventType evt) {
    super.onLifecycleEvent(evt);
    if (evt == LifecycleEventType.AFTER_NODE_START) {
      Ignite ignite0 = Ignition.ignite(ignite.name());
      assertNotNull(ignite0);
      assertNotNull(ignite0.cluster().localNode());
      done.set(true);
    }
  }
};

代码示例来源:origin: apache/ignite

/**
 * @param args Args.
 * @throws Exception If failed.
 */
public static void main(String[] args) throws Exception {
  Ignition.start("modules/core/src/test/config/load/dsi-49-server-production.xml");
  IgniteCache<Long, Long> cache = Ignition.ignite("dsi").cache("PARTITIONED_CACHE");
  stats();
  for (int i = 0; i < 5000000; i++) {
    long t0 = System.currentTimeMillis();
    cnt.incrementAndGet();
    cache.get(id.incrementAndGet());
    latency.addAndGet(System.currentTimeMillis() - t0);
  }
  System.out.println("Finished test.");
  if (t != null) {
    t.interrupt();
    t.join();
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void onApplicationEvent(ContextRefreshedEvent event) {
  if (ignite == null) {
    if (cfgPath != null && cfg != null) {
      throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
        "provided. Set only one of these properties if you need to start a Ignite node inside of " +
        "SpringCacheManager. If you already have a node running, omit both of them and set" +
        "'igniteInstanceName' property.");
    }
    try {
      if (cfgPath != null) {
        ignite = IgniteSpring.start(cfgPath, springCtx);
      }
      else if (cfg != null)
        ignite = IgniteSpring.start(cfg, springCtx);
      else
        ignite = Ignition.ignite(igniteInstanceName);
    }
    catch (IgniteCheckedException e) {
      throw U.convertException(e);
    }
  }
  if (transactionConcurrency == null)
    transactionConcurrency = ignite.configuration().getTransactionConfiguration().getDefaultTxConcurrency();
  log = ignite.log();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override protected NativeProcess transformSpecification(TensorFlowServer spec) {
  return new NativeProcess(
    new TensorFlowProcessBuilderSupplier(
      true,
      true,
      "job:" + spec.getJobName(),
      "task:" + spec.getTaskIdx()
    ),
    scriptFormatter.format(spec, true, Ignition.ignite()),
    getNode(spec)
  );
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  @Override public void run() {
    Supplier<ProcessBuilder> procBuilderSupplier = procSpec.getProcBuilderSupplier();
    ProcessBuilder procBuilder = procBuilderSupplier.get();

    NativeProcessRunner procRunner = new NativeProcessRunner(
      procBuilder,
      procSpec.getStdin(),
      System.out::println,
      System.err::println
    );

    IgniteLogger log = Ignition.ignite().log().getLogger(NativeProcessStartTask.class);

    try {
      log.debug("Starting native process");
      procRunner.startAndWait();
      log.debug("Native process completed");
    }
    catch (InterruptedException e) {
      log.debug("Native process interrupted");
    }
    catch (Exception e) {
      log.error("Native process failed", e);
      throw e;
    }
  }
}

代码示例来源:origin: apache/ignite

/**
 * Starts streamer.
 *
 * @throws IgniteException If failed.
 */
@Override
public void open(Configuration parameter) {
  A.notNull(igniteCfgFile, "Ignite config file");
  A.notNull(cacheName, "Cache name");
  try {
    // if an ignite instance is already started in same JVM then use it.
    this.ignite = Ignition.ignite();
  } catch (IgniteIllegalStateException e) {
    this.ignite = Ignition.start(igniteCfgFile);
  }
  this.ignite.getOrCreateCache(cacheName);
  this.log = this.ignite.log();
  this.streamer = this.ignite.dataStreamer(cacheName);
  this.streamer.autoFlushFrequency(autoFlushFrequency);
  this.streamer.allowOverwrite(allowOverwrite);
  stopped = false;
}

代码示例来源:origin: apache/ignite

g = Ignition.ignite("dsi");

代码示例来源:origin: apache/ignite

G.stop(Ignition.ignite(primaryNode.id()).name(), true);

代码示例来源:origin: it.unibo.alchemist/alchemist-grid

@Override
public Map<String, byte[]> getDependencies() {
  final IgniteCache<String, byte[]> cache = Ignition.ignite().cache(this.cacheName);
  return cache.getAll(this.keys);
}

代码示例来源:origin: it.unibo.alchemist/alchemist-grid

@Override
public void close() {
  Ignition.ignite().cache(this.cacheName).clear();
  Ignition.ignite().cache(this.cacheName).destroy();
}

代码示例来源:origin: org.apache.ignite/ignite-spring

/** {@inheritDoc} */
@Override public void onApplicationEvent(ContextRefreshedEvent event) {
  if (ignite == null) {
    if (cfgPath != null && cfg != null) {
      throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
        "provided. Set only one of these properties if you need to start a Ignite node inside of " +
        "SpringCacheManager. If you already have a node running, omit both of them and set" +
        "'igniteInstanceName' property.");
    }
    try {
      if (cfgPath != null) {
        ignite = IgniteSpring.start(cfgPath, springCtx);
      }
      else if (cfg != null)
        ignite = IgniteSpring.start(cfg, springCtx);
      else
        ignite = Ignition.ignite(igniteInstanceName);
    }
    catch (IgniteCheckedException e) {
      throw U.convertException(e);
    }
  }
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ignite

private void startIgnite(IgniteConfiguration conf) {
  try {
    cacheManager = (IgniteEx) Ignition.ignite( gridName );
  }
  catch (IgniteIllegalStateException iise) {
    // not found, then start
    conf.setIgniteInstanceName( gridName );
    cacheManager = (IgniteEx) Ignition.start( conf );
    if ( conf.getPersistentStoreConfiguration() != null && !conf.isClientMode() ) {
      cacheManager.active( true );
    }
    stopOnExit = true;
  }
}

代码示例来源:origin: org.apache.ignite/ignite-spring

/** {@inheritDoc} */
@Override public void onApplicationEvent(ContextRefreshedEvent event) {
  if (ignite == null) {
    if (cfgPath != null && cfg != null) {
      throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
        "provided. Set only one of these properties if you need to start a Ignite node inside of " +
        "SpringCacheManager. If you already have a node running, omit both of them and set" +
        "'igniteInstanceName' property.");
    }
    try {
      if (cfgPath != null) {
        ignite = IgniteSpring.start(cfgPath, springCtx);
      }
      else if (cfg != null)
        ignite = IgniteSpring.start(cfg, springCtx);
      else
        ignite = Ignition.ignite(igniteInstanceName);
    }
    catch (IgniteCheckedException e) {
      throw U.convertException(e);
    }
  }
  if (transactionConcurrency == null)
    transactionConcurrency = ignite.configuration().getTransactionConfiguration().getDefaultTxConcurrency();
  log = ignite.log();
}

相关文章