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

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

本文整理了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

  1. /**
  2. * Formats "TF_CLUSTER" variable to be passed into user script.
  3. *
  4. * @return Formatted "TF_CLUSTER" variable to be passed into user script.
  5. */
  6. private String formatTfClusterVar() {
  7. return clusterSpec.format(Ignition.ignite());
  8. }

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

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

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

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

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

  1. /** {@inheritDoc} */
  2. @Override public ProcessBuilder get() {
  3. ProcessBuilder pythonProcBuilder = super.get();
  4. Ignite ignite = Ignition.ignite();
  5. ClusterNode locNode = ignite.cluster().localNode();
  6. Integer port = locNode.attribute(ClientListenerProcessor.CLIENT_LISTENER_PORT);
  7. Map<String, String> env = pythonProcBuilder.environment();
  8. env.put(ENV_PREFIX + "HOST", "localhost");
  9. if (port != null)
  10. env.put(ENV_PREFIX + "PORT", String.valueOf(port));
  11. if (loc != null)
  12. env.put(ENV_PREFIX + "LOCAL", String.valueOf(loc));
  13. return pythonProcBuilder;
  14. }
  15. }

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

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

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

  1. /** {@inheritDoc} */
  2. @Override public R call() throws Exception {
  3. Ignite ignite = Ignition.ignite(id);
  4. return job.call(ignite);
  5. }
  6. }

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

  1. /** {@inheritDoc} */
  2. @Override public void onApplicationEvent(ContextRefreshedEvent event) {
  3. if (ignite == null) {
  4. if (cfgPath != null && cfg != null) {
  5. throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
  6. "provided. Set only one of these properties if you need to start a Ignite node inside of " +
  7. "SpringCacheManager. If you already have a node running, omit both of them and set" +
  8. "'igniteInstanceName' property.");
  9. }
  10. try {
  11. if (cfgPath != null) {
  12. ignite = IgniteSpring.start(cfgPath, springCtx);
  13. }
  14. else if (cfg != null)
  15. ignite = IgniteSpring.start(cfg, springCtx);
  16. else
  17. ignite = Ignition.ignite(igniteInstanceName);
  18. }
  19. catch (IgniteCheckedException e) {
  20. throw U.convertException(e);
  21. }
  22. }
  23. }

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

  1. @Override public void onLifecycleEvent(LifecycleEventType evt) {
  2. super.onLifecycleEvent(evt);
  3. if (evt == LifecycleEventType.AFTER_NODE_START) {
  4. Ignite ignite0 = Ignition.ignite(ignite.name());
  5. assertNotNull(ignite0);
  6. assertNotNull(ignite0.cluster().localNode());
  7. done.set(true);
  8. }
  9. }
  10. };

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

  1. /**
  2. * @param args Args.
  3. * @throws Exception If failed.
  4. */
  5. public static void main(String[] args) throws Exception {
  6. Ignition.start("modules/core/src/test/config/load/dsi-49-server-production.xml");
  7. IgniteCache<Long, Long> cache = Ignition.ignite("dsi").cache("PARTITIONED_CACHE");
  8. stats();
  9. for (int i = 0; i < 5000000; i++) {
  10. long t0 = System.currentTimeMillis();
  11. cnt.incrementAndGet();
  12. cache.get(id.incrementAndGet());
  13. latency.addAndGet(System.currentTimeMillis() - t0);
  14. }
  15. System.out.println("Finished test.");
  16. if (t != null) {
  17. t.interrupt();
  18. t.join();
  19. }
  20. }

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

  1. /** {@inheritDoc} */
  2. @Override public void onApplicationEvent(ContextRefreshedEvent event) {
  3. if (ignite == null) {
  4. if (cfgPath != null && cfg != null) {
  5. throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
  6. "provided. Set only one of these properties if you need to start a Ignite node inside of " +
  7. "SpringCacheManager. If you already have a node running, omit both of them and set" +
  8. "'igniteInstanceName' property.");
  9. }
  10. try {
  11. if (cfgPath != null) {
  12. ignite = IgniteSpring.start(cfgPath, springCtx);
  13. }
  14. else if (cfg != null)
  15. ignite = IgniteSpring.start(cfg, springCtx);
  16. else
  17. ignite = Ignition.ignite(igniteInstanceName);
  18. }
  19. catch (IgniteCheckedException e) {
  20. throw U.convertException(e);
  21. }
  22. }
  23. if (transactionConcurrency == null)
  24. transactionConcurrency = ignite.configuration().getTransactionConfiguration().getDefaultTxConcurrency();
  25. log = ignite.log();
  26. }

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

  1. /** {@inheritDoc} */
  2. @Override protected NativeProcess transformSpecification(TensorFlowServer spec) {
  3. return new NativeProcess(
  4. new TensorFlowProcessBuilderSupplier(
  5. true,
  6. true,
  7. "job:" + spec.getJobName(),
  8. "task:" + spec.getTaskIdx()
  9. ),
  10. scriptFormatter.format(spec, true, Ignition.ignite()),
  11. getNode(spec)
  12. );
  13. }

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

  1. /** {@inheritDoc} */
  2. @Override public void run() {
  3. Supplier<ProcessBuilder> procBuilderSupplier = procSpec.getProcBuilderSupplier();
  4. ProcessBuilder procBuilder = procBuilderSupplier.get();
  5. NativeProcessRunner procRunner = new NativeProcessRunner(
  6. procBuilder,
  7. procSpec.getStdin(),
  8. System.out::println,
  9. System.err::println
  10. );
  11. IgniteLogger log = Ignition.ignite().log().getLogger(NativeProcessStartTask.class);
  12. try {
  13. log.debug("Starting native process");
  14. procRunner.startAndWait();
  15. log.debug("Native process completed");
  16. }
  17. catch (InterruptedException e) {
  18. log.debug("Native process interrupted");
  19. }
  20. catch (Exception e) {
  21. log.error("Native process failed", e);
  22. throw e;
  23. }
  24. }
  25. }

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

  1. /**
  2. * Starts streamer.
  3. *
  4. * @throws IgniteException If failed.
  5. */
  6. @Override
  7. public void open(Configuration parameter) {
  8. A.notNull(igniteCfgFile, "Ignite config file");
  9. A.notNull(cacheName, "Cache name");
  10. try {
  11. // if an ignite instance is already started in same JVM then use it.
  12. this.ignite = Ignition.ignite();
  13. } catch (IgniteIllegalStateException e) {
  14. this.ignite = Ignition.start(igniteCfgFile);
  15. }
  16. this.ignite.getOrCreateCache(cacheName);
  17. this.log = this.ignite.log();
  18. this.streamer = this.ignite.dataStreamer(cacheName);
  19. this.streamer.autoFlushFrequency(autoFlushFrequency);
  20. this.streamer.allowOverwrite(allowOverwrite);
  21. stopped = false;
  22. }

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

  1. g = Ignition.ignite("dsi");

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

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

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

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

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

  1. @Override
  2. public void close() {
  3. Ignition.ignite().cache(this.cacheName).clear();
  4. Ignition.ignite().cache(this.cacheName).destroy();
  5. }

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

  1. /** {@inheritDoc} */
  2. @Override public void onApplicationEvent(ContextRefreshedEvent event) {
  3. if (ignite == null) {
  4. if (cfgPath != null && cfg != null) {
  5. throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
  6. "provided. Set only one of these properties if you need to start a Ignite node inside of " +
  7. "SpringCacheManager. If you already have a node running, omit both of them and set" +
  8. "'igniteInstanceName' property.");
  9. }
  10. try {
  11. if (cfgPath != null) {
  12. ignite = IgniteSpring.start(cfgPath, springCtx);
  13. }
  14. else if (cfg != null)
  15. ignite = IgniteSpring.start(cfg, springCtx);
  16. else
  17. ignite = Ignition.ignite(igniteInstanceName);
  18. }
  19. catch (IgniteCheckedException e) {
  20. throw U.convertException(e);
  21. }
  22. }
  23. }

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

  1. private void startIgnite(IgniteConfiguration conf) {
  2. try {
  3. cacheManager = (IgniteEx) Ignition.ignite( gridName );
  4. }
  5. catch (IgniteIllegalStateException iise) {
  6. // not found, then start
  7. conf.setIgniteInstanceName( gridName );
  8. cacheManager = (IgniteEx) Ignition.start( conf );
  9. if ( conf.getPersistentStoreConfiguration() != null && !conf.isClientMode() ) {
  10. cacheManager.active( true );
  11. }
  12. stopOnExit = true;
  13. }
  14. }

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

  1. /** {@inheritDoc} */
  2. @Override public void onApplicationEvent(ContextRefreshedEvent event) {
  3. if (ignite == null) {
  4. if (cfgPath != null && cfg != null) {
  5. throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " +
  6. "provided. Set only one of these properties if you need to start a Ignite node inside of " +
  7. "SpringCacheManager. If you already have a node running, omit both of them and set" +
  8. "'igniteInstanceName' property.");
  9. }
  10. try {
  11. if (cfgPath != null) {
  12. ignite = IgniteSpring.start(cfgPath, springCtx);
  13. }
  14. else if (cfg != null)
  15. ignite = IgniteSpring.start(cfg, springCtx);
  16. else
  17. ignite = Ignition.ignite(igniteInstanceName);
  18. }
  19. catch (IgniteCheckedException e) {
  20. throw U.convertException(e);
  21. }
  22. }
  23. if (transactionConcurrency == null)
  24. transactionConcurrency = ignite.configuration().getTransactionConfiguration().getDefaultTxConcurrency();
  25. log = ignite.log();
  26. }

相关文章