You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/08/10 00:46:10 UTC

[GitHub] [ignite] isapego opened a new pull request #9312: IGNITE-12177: Java compute tasks for C++

isapego opened a new pull request #9312:
URL: https://github.com/apache/ignite/pull/9312


   1. Implemented `Compute::ExecuteJavaTask` methods family that allow execution of java tasks by name.
   2. Added tests.
   3. Fixed logic of creation of `Compute` objects on the given `ClusterGroup`
   
   ### The Contribution Checklist
   - [x] There is a single JIRA ticket related to the pull request. 
   - [x] The web-link to the pull request is attached to the JIRA ticket.
   - [x] The JIRA ticket has the _Patch Available_ state.
   - [x] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [x] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] asfgit closed pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #9312:
URL: https://github.com/apache/ignite/pull/9312


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ptupitsyn commented on a change in pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
ptupitsyn commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687593126



##########
File path: modules/platforms/cpp/binary/include/ignite/impl/interop/interop_memory.h
##########
@@ -48,7 +48,19 @@ namespace ignite
 
             /** Flag: acquired. */
             const int IGNITE_MEM_FLAG_ACQUIRED = 0x4;
-                
+
+            union BinaryFloatInt32

Review comment:
       Missing comments.

##########
File path: modules/platforms/cpp/core-test/include/ignite/compute_types.h
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_CORE_TEST_COMPUTE_TYPES
+#define _IGNITE_CORE_TEST_COMPUTE_TYPES
+
+#include <stdint.h>
+#include <string>
+
+#include <ignite/ignite_predicate.h>
+#include <ignite/cluster/cluster_node.h>
+
+namespace ignite_test
+{
+    /*
+     * Check if cluster node contain the attribute with name provided.
+     */
+    class HasAttrName : public ignite::IgnitePredicate<ignite::cluster::ClusterNode>
+    {
+    public:
+        HasAttrName(std::string name) :
+        name(name)

Review comment:
       Missing indentation.

##########
File path: .idea/inspectionProfiles/Project_Default.xml
##########
@@ -1,776 +1,764 @@
-<profile version="1.0">

Review comment:
       Is this huge change intentional?

##########
File path: modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
##########
@@ -198,7 +208,214 @@ namespace ignite
                     return PerformTask<void, F, JobType, TaskType>(Operation::BROADCAST, func);
                 }
 
+                /**
+                 * Executes given Java task on the grid projection. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename R, typename A>
+                R ExecuteJavaTask(const std::string& taskName, const A& taskArg)
+                {
+                    return PerformJavaTask<R, A>(taskName, &taskArg);
+                }
+
+                /**
+                 * Executes given Java task on the grid projection. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 */
+                template<typename R>
+                R ExecuteJavaTask(const std::string& taskName)
+                {
+                    return PerformJavaTask<R, int>(taskName, 0);
+                }
+
+                /**
+                 * Asynchronously executes given Java task on the grid projection. If task for given name has not been
+                 * deployed yet, then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @return Future containing a result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename R, typename A>
+                Future<R> ExecuteJavaTaskAsync(const std::string& taskName, const A& taskArg)
+                {
+                    return PerformJavaTaskAsync<R, A>(taskName, &taskArg);
+                }
+
+                /**
+                 * Asynchronously executes given Java task on the grid projection. If task for given name has not been
+                 * deployed yet, then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @return Future containing a result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 */
+                template<typename R>
+                Future<R> ExecuteJavaTaskAsync(const std::string& taskName)
+                {
+                    return PerformJavaTaskAsync<R, int>(taskName, 0);
+                }
+
             private:
+                IGNITE_NO_COPY_ASSIGNMENT(ComputeImpl);
+
+                struct FutureType
+                {
+                    enum Type
+                    {
+                        F_BYTE = 1,
+                        F_BOOL = 2,
+                        F_SHORT = 3,
+                        F_CHAR = 4,
+                        F_INT = 5,
+                        F_FLOAT = 6,
+                        F_LONG = 7,
+                        F_DOUBLE = 8,
+                        F_OBJECT = 9,
+                    };
+                };
+
+                template<typename T> struct FutureTypeForType { static const int32_t value = FutureType::F_OBJECT; };
+
+                /**
+                 * @return True if projection for the compute contains predicate.
+                 */
+                bool ProjectionContainsPredicate() const;
+
+                /**
+                 * @return Nodes for the compute.
+                 */
+                std::vector<ignite::cluster::ClusterNode> GetNodes();
+
+                /**
+                 * Write Java task using provided writer. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @param writer Binary writer.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename A>
+                void WriteJavaTask(const std::string& taskName, const A* arg, binary::BinaryWriterImpl& writer) {
+                    writer.WriteString(taskName);
+                    // Keep binary flag

Review comment:
       Missing blank line before comment.

##########
File path: modules/platforms/cpp/core-test/include/ignite/compute_types.h
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_CORE_TEST_COMPUTE_TYPES
+#define _IGNITE_CORE_TEST_COMPUTE_TYPES
+
+#include <stdint.h>
+#include <string>
+
+#include <ignite/ignite_predicate.h>
+#include <ignite/cluster/cluster_node.h>
+
+namespace ignite_test
+{
+    /*
+     * Check if cluster node contain the attribute with name provided.

Review comment:
       `contains an attribute`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687607943



##########
File path: modules/platforms/cpp/core-test/include/ignite/compute_types.h
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_CORE_TEST_COMPUTE_TYPES
+#define _IGNITE_CORE_TEST_COMPUTE_TYPES
+
+#include <stdint.h>
+#include <string>
+
+#include <ignite/ignite_predicate.h>
+#include <ignite/cluster/cluster_node.h>
+
+namespace ignite_test
+{
+    /*
+     * Check if cluster node contain the attribute with name provided.
+     */
+    class HasAttrName : public ignite::IgnitePredicate<ignite::cluster::ClusterNode>
+    {
+    public:
+        HasAttrName(std::string name) :
+        name(name)

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687608302



##########
File path: modules/platforms/cpp/core-test/include/ignite/compute_types.h
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_CORE_TEST_COMPUTE_TYPES
+#define _IGNITE_CORE_TEST_COMPUTE_TYPES
+
+#include <stdint.h>
+#include <string>
+
+#include <ignite/ignite_predicate.h>
+#include <ignite/cluster/cluster_node.h>
+
+namespace ignite_test
+{
+    /*
+     * Check if cluster node contain the attribute with name provided.

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687608481



##########
File path: modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
##########
@@ -198,7 +208,214 @@ namespace ignite
                     return PerformTask<void, F, JobType, TaskType>(Operation::BROADCAST, func);
                 }
 
+                /**
+                 * Executes given Java task on the grid projection. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename R, typename A>
+                R ExecuteJavaTask(const std::string& taskName, const A& taskArg)
+                {
+                    return PerformJavaTask<R, A>(taskName, &taskArg);
+                }
+
+                /**
+                 * Executes given Java task on the grid projection. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 */
+                template<typename R>
+                R ExecuteJavaTask(const std::string& taskName)
+                {
+                    return PerformJavaTask<R, int>(taskName, 0);
+                }
+
+                /**
+                 * Asynchronously executes given Java task on the grid projection. If task for given name has not been
+                 * deployed yet, then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @return Future containing a result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename R, typename A>
+                Future<R> ExecuteJavaTaskAsync(const std::string& taskName, const A& taskArg)
+                {
+                    return PerformJavaTaskAsync<R, A>(taskName, &taskArg);
+                }
+
+                /**
+                 * Asynchronously executes given Java task on the grid projection. If task for given name has not been
+                 * deployed yet, then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @return Future containing a result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 */
+                template<typename R>
+                Future<R> ExecuteJavaTaskAsync(const std::string& taskName)
+                {
+                    return PerformJavaTaskAsync<R, int>(taskName, 0);
+                }
+
             private:
+                IGNITE_NO_COPY_ASSIGNMENT(ComputeImpl);
+
+                struct FutureType
+                {
+                    enum Type
+                    {
+                        F_BYTE = 1,
+                        F_BOOL = 2,
+                        F_SHORT = 3,
+                        F_CHAR = 4,
+                        F_INT = 5,
+                        F_FLOAT = 6,
+                        F_LONG = 7,
+                        F_DOUBLE = 8,
+                        F_OBJECT = 9,
+                    };
+                };
+
+                template<typename T> struct FutureTypeForType { static const int32_t value = FutureType::F_OBJECT; };
+
+                /**
+                 * @return True if projection for the compute contains predicate.
+                 */
+                bool ProjectionContainsPredicate() const;
+
+                /**
+                 * @return Nodes for the compute.
+                 */
+                std::vector<ignite::cluster::ClusterNode> GetNodes();
+
+                /**
+                 * Write Java task using provided writer. If task for given name has not been deployed yet,
+                 * then 'taskName' will be used as task class name to auto-deploy the task.
+                 *
+                 * @param taskName Java task name.
+                 * @param taskArg Argument of task execution of type A.
+                 * @param writer Binary writer.
+                 * @return Task result of type @c R.
+                 *
+                 * @tparam R Type of task result.
+                 * @tparam A Type of task argument.
+                 */
+                template<typename A>
+                void WriteJavaTask(const std::string& taskName, const A* arg, binary::BinaryWriterImpl& writer) {
+                    writer.WriteString(taskName);
+                    // Keep binary flag

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9312: IGNITE-12177: Java compute tasks for C++

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687607711



##########
File path: modules/platforms/cpp/binary/include/ignite/impl/interop/interop_memory.h
##########
@@ -48,7 +48,19 @@ namespace ignite
 
             /** Flag: acquired. */
             const int IGNITE_MEM_FLAG_ACQUIRED = 0x4;
-                
+
+            union BinaryFloatInt32

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org