Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsupportedOperationException when calling schedulerapi.killTask #2749

Closed
lpellegr opened this issue Dec 22, 2016 · 5 comments
Closed

UnsupportedOperationException when calling schedulerapi.killTask #2749

lpellegr opened this issue Dec 22, 2016 · 5 comments
Assignees
Milestone

Comments

@lpellegr
Copy link
Contributor

Killing a task by using the schedulerapi variable is not possible. The following exception is thrown:

[176t0@trydev.activeeon.com;11:23:55] Failed to execute task: javax.script.ScriptException: java.lang.UnsupportedOperationException
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:211)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:149)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.fromForkedJVM(ExecuteForkedTaskInsideNewJvm.java:88)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scheduler.task.executors.forked.env.ExecuteForkedTaskInsideNewJvm.main(ExecuteForkedTaskInsideNewJvm.java:78)
[176t0@trydev.activeeon.com;11:23:55] Caused by: org.ow2.proactive.scripting.ScriptException: javax.script.ScriptException: java.lang.UnsupportedOperationException
[176t0@trydev.activeeon.com;11:23:55] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
[176t0@trydev.activeeon.com;11:23:55] at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130)
[176t0@trydev.activeeon.com;11:23:55] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scripting.Script.execute(Script.java:312)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scripting.ScriptHandler.handle(ScriptHandler.java:76)
[176t0@trydev.activeeon.com;11:23:55] at org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor.execute(InProcessTaskExecutor.java:207)
[176t0@trydev.activeeon.com;11:23:55] ... 3 more

Below is a Workflow example:

<?xml version="1.0" encoding="UTF-8"?>
<job
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:proactive:jobdescriptor:3.7"
     xsi:schemaLocation="urn:proactive:jobdescriptor:3.7 http://www.activeeon.com/public_content/schemas/proactive/jobdescriptor/3.7/schedulerjob.xsd"
    name="schedulerapi" 
    priority="normal"
    onTaskError="continueJobExecution"
     maxNumberOfExecution="2"
>
  <taskFlow>
    <task name="Groovy_Task">
      <description>
        <![CDATA[ The simplest task, ran by a groovy engine. ]]>
      </description>
      <scriptExecutable>
        <script>
          <code language="groovy">
            <![CDATA[
jobId = variables.get("PA_JOB_ID")
taskName = variables.get("PA_TASK_NAME")

schedulerapi.connect()
schedulerapi.killTask(jobId, taskName)
]]>
          </code>
        </script>
      </scriptExecutable>
    </task>
  </taskFlow>
</job>

The schedulerapi is an instance of SchedulerNodeClient class. This last forwards internally to an instance of SchedulerClient. SchedulerClient extends ClientBase but does not override killTask like for other methods. Since the default behaviour from ClientBase is throw new UnsupportedOperationException();, the task is not killed.

In summary, it looks like it was forgotten to override killTask in SchedulerClient.

Tests should be added for all methods in these clients.

@fviale fviale added this to the 7.23.0 milestone Jan 3, 2017
@fviale fviale self-assigned this Jan 3, 2017
@fviale
Copy link
Member

fviale commented Jan 3, 2017

this issue has been fixed by the following commit:

3109091

@fviale fviale closed this as completed Jan 3, 2017
@lpellegr
Copy link
Contributor Author

lpellegr commented Jan 3, 2017

I reopen the issue since what was reported has not been completely addressed:

Tests should be added for all methods in these clients.

@lpellegr lpellegr reopened this Jan 3, 2017
@fviale
Copy link
Member

fviale commented Jan 3, 2017

I would prefer if you create then a new issue.

@lpellegr
Copy link
Contributor Author

lpellegr commented Jan 3, 2017

I do not prefer. Adding at least a few tests while fixing an issue is part of a normal process. Furthermore, this was mentioned at the first place when I reported the issue. Creating a new issue will scatter the work and make actions and the general process even more confusing.

@fviale
Copy link
Member

fviale commented Jan 3, 2017

Fair enough, but this request "Tests should be added for all methods in these clients" is just too big. There is no such exhaustive test which cover all of the standard scheduler api. It's basically tested through many different tests, because each test requires a complex setup, for example when you call the killTask method, you need to verify that the task has actually been killed, etc, etc.

fviale added a commit that referenced this issue Feb 7, 2017
Implemented test for issue UnsupportedOperationException when calling schedulerapi.killTask #2749
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants