lubican
lubican

Reputation: 29

Failing to update existing vertices

I'm updating some properties of vertices in janusgraph. May contain up to 500000 vertices updates. Underline db is cassandra. While doing those updates i receive the following error:

org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 60000000 ms or evaluation was otherwise cancelled directly for request [g.V().has(IProKeys_A_ID, analysisId).has(quaPro, propValue).id()]

The code:

...
// 1. retrieve SPC property different values
        Cluster cluster = gremlinCluster.getCluster();
        Client client = null;
        List<String> propertyValues = Lists.newArrayList();
        try {
            client = cluster.connect();
            String gremlin = "g.V().has(IPr_a_ID, aId).values(qProperty).dedup()";
            Map<String, Object> parameters = Maps.newHashMap();
            parameters.put("IPr_a_ID", IPropertyKeys.ANALYSIS_ID);
            parameters.put("aId", analysisResultId);
            parameters.put("qProperty", qProperty);
            if (logger.isDebugEnabled()) logger.debug("Submiting query [ " + gremlin + " ] with binding [ " + parameters + "]");
            ResultSet resultSet = client.submit(gremlin, parameters);
            if (logger.isDebugEnabled()) logger.debug("Query finished.");
            resultSet.stream().forEach(result -> {
                String propertyValue = result.getString();
                propertyValues.add(propertyValue);
            });

        } catch
...
..
..
..
// 2. for each property value, run gremlin query to assign new grouptag property to proper vertices
        try {
            client = cluster.connect();
        for (String propValue : propertyValues) {
            String gremlin = "g.V().has(IProKeys_A_ID,analysisId).has(quaPro, propValue).property(qGtag,propValue).iterate(); return null";
            Map<String, Object> parameters = Maps.newHashMap();
            parameters.put("IProKeys_A_ID", IP_ID);
            parameters.put("analysisId", aisRId);
            parameters.put("quaPro", q_Property);
            parameters.put("qGtag", qu_dG_ptag);
            parameters.put("propValue", propValue);
            if (logger.isDebugEnabled()) logger.debug("Submiting query [ " + gremlin + " ] with binding [ " + parameters + "]");
            client.submit(gremlin, parameters).one();
            if (logger.isDebugEnabled()) logger.debug("Query finished.");
        }

Can you please let me know the reason for getting this error?

Upvotes: 0

Views: 234

Answers (1)

stephen mallette
stephen mallette

Reputation: 46206

Hard to say why you would have timeout issues exactly. I will say that I notice you create new Client instances from the Cluster object. If you are creating a lot of those, that might explain some of the problem (even if you are calling close() on the Client each time). I would definitely look at modifying your code to just create the Client once and re-use it.

Also, for 500,000 vertices you might want to look at an OLAP method (hadoop/spark) for updating that much data.

Upvotes: 1

Related Questions