You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@linkis.apache.org by GitBox <gi...@apache.org> on 2021/11/03 12:32:24 UTC

[GitHub] [incubator-linkis] wForget commented on issue #1063: Support engine operator

wForget commented on issue #1063:
URL: https://github.com/apache/incubator-linkis/issues/1063#issuecomment-958988873


   ## Test
   
   ### 1. In linkis-engineplugin-shell, add the `TestOperator` to implement the `Operator` interface:
   
   ```
   class TestOperator extends Operator {
     override def getName: String = "test"
   
     override def apply(): EngineOperateResponse = {
       val result: Map[String, Any] = Map(
         "test" -> "testValue"
       )
       EngineOperateResponse(result)
     }
   
     override def init(properties: Map[String, Any]): Unit = { }
   }
   ```
   
   ### 2. Client test:
   
   ```
     val serverUrl = "http://testip:9001"
     val username = "test"
     val password = "test"
     // Suggest to use LinkisJobClient to submit job to Linkis.
     val clientConfig = DWSClientConfigBuilder.newBuilder().addServerUrl(serverUrl)
       .connectionTimeout(30000).discoveryEnabled(true)
       .discoveryFrequency(1, TimeUnit.MINUTES)
       .loadbalancerEnabled(true).maxConnectionSize(5)
       .retryEnabled(false).readTimeout(30000)
       .setAuthenticationStrategy(new StaticAuthenticationStrategy())
       .setAuthTokenKey(username)
       .setAuthTokenValue(password).setDWSVersion("v1").build()
   
     val client = UJESClient(clientConfig)
   
     val managerClient = LinkisManagerClient(client)
   
     val engineConnInstance = "engineconnIp:11635"
     val engineOperateAction = EngineOperateAction.newBuilder()
       .operatorName("test")
       .setUser(username)
       .setApplicationName("linkis-cg-engineconn")
       .setInstance(engineConnInstance)
       .build()
   
     val result = managerClient.executeEngineOperation(engineOperateAction)
   
     println(result.getResult)
   ```
   
   output:
   
   ```
   {test=testValue}
   ```


-- 
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: dev-unsubscribe@linkis.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For additional commands, e-mail: dev-help@linkis.apache.org