ref 21031: Add support to Jupyter

Updated Jupyter Accesses Harvester
This commit is contained in:
Giancarlo Panichi 2021-03-26 16:04:07 +01:00
parent 38ec08e0a3
commit 24f2409df7
5 changed files with 42 additions and 19 deletions

View File

@ -80,7 +80,7 @@ public class JupyterAccessesHarvester extends BasicHarvester {
public JupyterAccessesHarvester(Date start, Date end) throws Exception {
super(start, end);
logger.debug("JupyerAccessHArvester: {}, {}",start,end);
logger.debug("JupyerAccessHArvester: {}, {}", start, end);
vreAccesses = getAllAccesses(start, end);
}
@ -95,21 +95,21 @@ public class JupyterAccessesHarvester extends BasicHarvester {
ScopeBean scopeBean = new ScopeBean(context);
String lowerCasedContext = scopeBean.name().toLowerCase();
logger.debug("JupyerAccessHArvester lowerCasedContext: {}",lowerCasedContext);
logger.debug("JupyerAccessHArvester lowerCasedContext: {}", lowerCasedContext);
for (VREAccessesReportRow row : vreAccesses) {
String pagePath = row.getPagePath().toLowerCase();
//logger.debug("JupyerAccessHArvester pagePath: {}",lowerCasedContext);
if (pagePath != null && !pagePath.isEmpty()) {
if (pagePath.contains(lowerCasedContext)) {
if (pagePath.contains("jupyter") || pagePath.contains("jupiter")) {
logger.trace("Matched jupyter or jupiter ({}) : {}", lowerCasedContext, pagePath);
measure += row.getVisitNumber();
if (!pagePath.contains("catalogue")) {
if (pagePath.contains("jupyter") || pagePath.contains("jupiter")) {
logger.trace("Matched jupyter or jupiter ({}) : {}", lowerCasedContext, pagePath);
measure += row.getVisitNumber();
}
}
}
}
}
ScopeDescriptor scopeDescriptor = AccountingDashboardHarvesterPlugin.getScopeDescriptor();
AccountingRecord ar = new AccountingRecord(scopeDescriptor, instant,

View File

@ -24,7 +24,6 @@ import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.dataharvest.datamodel.HarvestedDataKey;
import org.gcube.dataharvest.harvester.CatalogueAccessesHarvester;
import org.gcube.dataharvest.harvester.CoreServicesAccessesHarvester;
import org.gcube.dataharvest.harvester.JupyterAccessesHarvester;
import org.gcube.dataharvest.harvester.MethodInvocationHarvester;
import org.gcube.dataharvest.harvester.SocialInteractionsHarvester;
import org.gcube.dataharvest.harvester.VREAccessesHarvester;
@ -42,6 +41,7 @@ import org.gcube.vremanagement.executor.api.types.Scheduling;
import org.gcube.vremanagement.executor.client.SmartExecutorClient;
import org.gcube.vremanagement.executor.client.SmartExecutorClientFactory;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.quartz.CronExpression;
import org.slf4j.Logger;
@ -71,7 +71,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
return contexts;
}
// @Test
@Ignore
@Test
public void getDimensions() {
try {
@ -90,7 +91,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
logger.error("", e);
}
}
@Ignore
@Test
public void launch() {
try {
@ -128,7 +130,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
// @Test
@Ignore
@Test
public void launchPluginOnSmartExecutor() {
try {
@ -181,7 +184,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
// @Test
@Ignore
//@Test
public void launchOldData() {
try {
@ -217,6 +221,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Ignore
// @Test
public void launchOldDataVREAccessesHarvester() {
try {
@ -317,6 +322,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
@Ignore
// @Test
public void testScopeBean() throws Exception {
ContextTest.setContextByName(ROOT);
@ -365,7 +371,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
// @Test
@Ignore
@Test
public void testVREAccessesHarvester() throws Exception {
try {
// AccountingDao dao = getAccountingDao();
@ -416,6 +423,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Ignore
// @Test
public void testVREAccessesHarvesterAll() {
try {
@ -494,7 +502,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Ignore
// @Test
public void testSocialInteraction() {
try {
@ -554,6 +562,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
@Ignore
// @Test
public void testMethodInvocation() {
try {
@ -616,6 +625,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
AccountingDashboardHarvesterPlugin.scopeDescriptor.set(actualScopeDescriptor);
}
@Ignore
// @Test
public void testTagMeMethodInvocation() throws Exception {
try {
@ -654,6 +664,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Ignore
// @Test
public void testGetVREUsersForSpecificVRE() {
try {
@ -689,6 +700,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
@Ignore
// @Test
public void testFilteringGenericResource() {
try {
@ -716,6 +728,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
@Ignore
// @Test
public void testResourceCatalogueHarvester() {
try {
@ -748,7 +761,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
logger.error("", e);
}
}
@Ignore
@Test
public void testCoreServicesHarvester() {
try {
@ -783,7 +797,8 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
logger.error("", e);
}
}
@Ignore
@Test
public void testCatalogueHarvester() {
try {
@ -819,6 +834,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
}
}
@Ignore
// @Test
public void testDataMethodDownloadHarvester() {
try {
@ -868,6 +884,7 @@ public class AccountingDataHarvesterPluginTest extends ContextTest {
public static final String E_LEARNING_AREA_VRE = "/d4science.research-infrastructures.eu/SoBigData/E-Learning_Area";
@Ignore
// @Test
public void addMissingVREAccesses() {
try {

View File

@ -3,6 +3,7 @@ package org.gcube.dataharvest.harvester.sobigdata;
import java.util.List;
import org.gcube.dataharvest.utils.ContextTest;
import org.junit.Ignore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -10,6 +11,7 @@ public class SoBigDataHarvesterTest extends ContextTest {
private static Logger logger = LoggerFactory.getLogger(SoBigDataHarvesterTest.class);
@Ignore
// @Test
public void testGroupList() throws Exception {
// ContextTest.setContextByName("/d4science.research-infrastructures.eu/D4Research/AGINFRAplusDev");

View File

@ -10,6 +10,7 @@ import org.gcube.dataharvest.harvester.JupyterAccessesHarvester;
import org.gcube.dataharvest.utils.AggregationType;
import org.gcube.dataharvest.utils.ContextTest;
import org.gcube.dataharvest.utils.DateUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -19,15 +20,16 @@ public class AccountingDataHarvesterJupyterTest extends ContextTest {
private static Logger logger = LoggerFactory.getLogger(AccountingDataHarvesterJupyterTest.class);
public static final String ROOT = "/d4science.research-infrastructures.eu";
private static final String SCOPE = "/d4science.research-infrastructures.eu/D4OS/Blue-CloudLab";
@Ignore
@Test
public void testJupyterccessesHarvester() throws Exception {
try {
// AccountingDao dao = getAccountingDao();
List<Date> starts = new ArrayList<>();
starts.add(DateUtils.getStartCalendar(2021, Calendar.JANUARY, 1).getTime());
starts.add(DateUtils.getStartCalendar(2021, Calendar.FEBRUARY, 1).getTime());
//starts.add(DateUtils.getStartCalendar(2021, Calendar.JANUARY, 1).getTime());
//starts.add(DateUtils.getStartCalendar(2021, Calendar.FEBRUARY, 1).getTime());
starts.add(DateUtils.getStartCalendar(2021, Calendar.MARCH, 1).getTime());
AggregationType measureType = AggregationType.MONTHLY;

View File

@ -5,6 +5,7 @@ import java.io.InputStream;
import java.util.Properties;
import org.gcube.dataharvest.AccountingDashboardHarvesterPlugin;
import org.junit.Ignore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -26,6 +27,7 @@ public class ContextAuthorizationTest extends ContextTest {
AccountingDashboardHarvesterPlugin.getProperties().set(properties);
}
@Ignore
// @Test
public void testRetrieveContextsAndTokens() throws Exception {
try {