use of org.apache.ignite.Ignite in project ignite by apache.
the class GroupTrainer method train.
/**
* {@inheritDoc}
*/
@Override
public final M train(T data) {
UUID trainingUUID = UUID.randomUUID();
LC locCtx = initialLocalContext(data, trainingUUID);
GroupTrainingContext<K, V, LC> ctx = new GroupTrainingContext<>(locCtx, cache, ignite);
ComputationsChain<LC, K, V, T, T> chain = (i, c) -> i;
IgniteFunction<GroupTrainerCacheKey<K>, ResultAndUpdates<IN>> distributedInitializer = distributedInitializer(data);
init(data, trainingUUID);
M res = chain.thenDistributedForKeys(distributedInitializer, (t, lc) -> data.initialKeys(trainingUUID), reduceDistributedInitData()).thenLocally(this::locallyProcessInitData).thenWhile(this::shouldContinue, trainingLoopStep()).thenDistributedForEntries(this::extractContextForFinalResultCreation, finalResultsExtractor(), this::finalResultKeys, finalResultsReducer()).thenLocally(this::mapFinalResult).process(data, ctx);
cleanup(locCtx);
return res;
}
use of org.apache.ignite.Ignite in project ignite by apache.
the class GridMBeanExoticNamesSelfTest method checkMBeanRegistration.
/**
* Test MBean registration.
*/
private void checkMBeanRegistration(String grp, String name) throws Exception {
// Node should start and stop with no errors.
try (Ignite ignite = startGrid(0)) {
MBeanServer srv = ignite.configuration().getMBeanServer();
U.registerMBean(srv, ignite.name(), grp, name, new DummyMBeanImpl(), DummyMBean.class);
ObjectName objName = U.makeMBeanName(ignite.name(), grp, name + '2');
U.registerMBean(srv, objName, new DummyMBeanImpl(), DummyMBean.class);
}
}
use of org.apache.ignite.Ignite in project ignite by apache.
the class LinuxNativeIoPluginProvider method start.
/**
* {@inheritDoc}
*/
@Override
public void start(PluginContext ctx) {
final Ignite ignite = ctx.grid();
log = ignite.log();
managedBuffers = setupDirect((IgniteEx) ignite);
}
use of org.apache.ignite.Ignite in project ignite by apache.
the class IgniteCacheJoinPartitionedAndReplicatedTest method testJoin.
/**
* @throws Exception If failed.
*/
public void testJoin() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-5016");
Ignite client = grid(2);
IgniteCache<Object, Object> personCache = client.cache(PERSON_CACHE);
IgniteCache<Object, Object> orgCache = client.cache(ORG_CACHE);
IgniteCache<Object, Object> orgCacheRepl = client.cache(ORG_CACHE_REPLICATED);
List<Integer> keys = primaryKeys(ignite(0).cache(PERSON_CACHE), 3, 200_000);
orgCache.put(keys.get(0), new Organization(0, "org1"));
orgCacheRepl.put(keys.get(0), new Organization(0, "org1"));
personCache.put(keys.get(1), new Person(0, "p1"));
personCache.put(keys.get(2), new Person(0, "p2"));
checkQuery("select o.name, p._key, p.name " + "from \"person\".Person p join \"org\".Organization o " + "on (p.orgId = o.id)", orgCache, 2);
checkQuery("select o.name, p._key, p.name " + "from \"org\".Organization o join \"person\".Person p " + "on (p.orgId = o.id)", orgCache, 2);
checkQuery("select o.name, p._key, p.name " + "from \"person\".Person p join \"orgRepl\".Organization o " + "on (p.orgId = o.id)", orgCacheRepl, 2);
checkQuery("select o.name, p._key, p.name " + "from \"orgRepl\".Organization o join \"person\".Person p " + "on (p.orgId = o.id)", orgCacheRepl, 2);
checkQuery("select p.name from \"person\".Person p", ignite(0).cache(PERSON_CACHE), 2);
checkQuery("select p.name from \"person\".Person p", ignite(1).cache(PERSON_CACHE), 2);
for (int i = 0; i < 10; i++) checkQuery("select p.name from \"person\".Person p", personCache, 2);
checkQuery("select o.name, p._key, p.name " + "from \"org\".Organization o left join \"person\".Person p " + "on (p.orgId = o.id)", orgCache, 2);
checkQuery("select o.name, p._key, p.name " + "from \"person\".Person p left join \"orgRepl\".Organization o " + "on (p.orgId = o.id)", orgCacheRepl, 2);
checkQuery("select o.name, p._key, p.name " + "from \"orgRepl\".Organization o left join \"person\".Person p " + "on (p.orgId = o.id)", orgCacheRepl, 2);
}
use of org.apache.ignite.Ignite in project ignite by apache.
the class IgniteCacheMultipleIndexedTypesTest method testMultipleIndexedTypes.
/**
* @throws Exception If failed.
*/
public void testMultipleIndexedTypes() throws Exception {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
List<QueryEntity> qryEntities = new ArrayList<>();
{
QueryEntity qryEntity = new QueryEntity();
qryEntity.setKeyType(Integer.class.getName());
qryEntity.setValueType(Person.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("name", String.class.getName());
qryEntity.setFields(fields);
qryEntity.setIndexes(F.asList(new QueryIndex("name")));
qryEntities.add(qryEntity);
}
{
QueryEntity qryEntity = new QueryEntity();
qryEntity.setKeyType(Integer.class.getName());
qryEntity.setValueType(Organization.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("name", String.class.getName());
qryEntity.setFields(fields);
qryEntity.setIndexes(F.asList(new QueryIndex("name")));
qryEntities.add(qryEntity);
}
ccfg.setQueryEntities(qryEntities);
Ignite ignite = ignite(0);
IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
checkCount(cache, Person.class, 0);
cache.put(1, new Person("a"));
checkCount(cache, Person.class, 1);
cache.remove(1);
checkCount(cache, Person.class, 0);
cache.put(1, new Person("a"));
checkCount(cache, Person.class, 1);
cache.put(1, new Organization("a"));
checkCount(cache, Person.class, 0);
checkCount(cache, Organization.class, 1);
cache.put(1, new Person("a"));
checkCount(cache, Person.class, 1);
checkCount(cache, Organization.class, 0);
cache.put(2, new Person("a"));
checkCount(cache, Person.class, 2);
checkCount(cache, Organization.class, 0);
cache.put(1, new Organization("a"));
checkCount(cache, Person.class, 1);
checkCount(cache, Organization.class, 1);
}
Aggregations