xenon-middleware / xenon-grpc

Xenon grpc based server
Apache License 2.0
0 stars 1 forks source link

Server cannot run simple job from Python #9

Closed jhidding closed 7 years ago

jhidding commented 7 years ago

I started building a Python wrapper for the Xenon-grpc client. Trying to run a simple job on the 'local' adapter creates a severe exception.

The script I'm running:

from xenon import Xenon
import time

with Xenon() as xenon:
    time.sleep(1)  # wait for Xenon to run

    scheduler = xenon.jobs.newScheduler(
        xenon.NewSchedulerRequest(adaptor='local'))

    job_description = xenon.JobDescription(
        executable='bash',
        arguments=['-c', 'echo', '"Hello, World!"'],
        stdOut='hello.txt')

    job = xenon.jobs.submitJob(xenon.SubmitJobRequest(
        scheduler=scheduler, description=job_description))
    job_status = xenon.jobs.waitUntilDone(job)
    if job_status.exitCode != 0:
        raise Exception(job_status.errorMessage)
    xenon.jobs.deleteJob(job)
    xenon.jobs.closeScheduler(scheduler)

ouput:

Starting Xenon-GRPC server.
Connecting to server
[out] time   : 14:54:12.568 (+431 ms)
[out] thread : main
[out] level  : INFO
[out] class  : nl.esciencecenter.xenon.grpc.XenonServer:40
[out] message: Server started, listening on 50051
[out] 
Terminating Xenon-GRPC server.
[err] jun 02, 2017 2:54:13 PM io.grpc.internal.SerializingExecutor run
[err] SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$2@1b0f8f7
[err] java.lang.NullPointerException
[err]   at java.util.HashMap.putMapEntries(HashMap.java:500)
[err]   at java.util.HashMap.putAll(HashMap.java:784)
[err]   at com.google.protobuf.MapField$MutatabilityAwareMap.putAll(MapField.java:343)
[err]   at nl.esciencecenter.xenon.grpc.XenonProto$JobStatus$Builder.putAllSchedulerSpecificInformation(XenonProto.java:34338)
[err]   at nl.esciencecenter.xenon.grpc.jobs.MapUtils.mapJobStatus(MapUtils.java:93)
[err]   at nl.esciencecenter.xenon.grpc.jobs.JobsService.waitUntilDone(JobsService.java:313)
[err]   at nl.esciencecenter.xenon.grpc.XenonJobsGrpc$MethodHandlers.invoke(XenonJobsGrpc.java:1223)
[err]   at io.grpc.stub.ServerCalls$1$1.onHalfClose(ServerCalls.java:148)
[err]   at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:262)
[err]   at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$2.runInContext(ServerImpl.java:572)
[err]   at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
[err]   at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
[err]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[err]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[err]   at java.lang.Thread.run(Thread.java:748)
[err] 
sverhoeven commented 7 years ago

Could you try again with HEAD from master? I add many tests and solved a bunch of nullpointerexceptions.

Also this job is not going to work with

bash -c echo hello world

this only prints a newline

What you want is

bash -c "echo hello world"

or

echo hello world
sverhoeven commented 7 years ago

See https://github.com/NLeSC/xenon-grpc/blob/master/src/test/java/nl/esciencecenter/xenon/grpc/jobs/LocalJobsServiceTest.java#L154-L178 for the Java version or your script.

jhidding commented 7 years ago

Now the server exits with

[err] usage: xenon-grpc-server [-h] [--port PORT]
[err]                          [--server-cert-chain SERVER_CERT_CHAIN]
[err]                          [--server-private-key SERVER_PRIVATE_KEY]
[err]                          [--client-cert-chain CLIENT_CERT_CHAIN]
[err] xenon-grpc-server: error: Unable to enable  mutual TLS. mutual TLS requires
[err] --server-cert-chain,    --server-private-key     and    --client-cert-chain
[err] arguments set
sverhoeven commented 7 years ago

Doh, I added TLS support, which broke the insecure mode. Please try again.