/** * 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()); }
/** * 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()); }
/** * 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())); }
/** {@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; } }
ignite = Ignition.ignite(igniteInstanceName == null ? null : igniteInstanceName.toString());
/** {@inheritDoc} */ @Override public R call() throws Exception { Ignite ignite = Ignition.ignite(id); return job.call(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); } } }
@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); } } };
/** * @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(); } }
/** {@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(); }
/** {@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) ); }
/** {@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; } } }
/** * 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; }
g = Ignition.ignite("dsi");
G.stop(Ignition.ignite(primaryNode.id()).name(), true);
@Override public Map<String, byte[]> getDependencies() { final IgniteCache<String, byte[]> cache = Ignition.ignite().cache(this.cacheName); return cache.getAll(this.keys); }
/** {@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); } } }
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; } }
/** {@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(); }