flux-framework/flux-workflow-examples

example2/submitter.py: a non-existent or unavailable function invocation has been detected

Closed this issue · 2 comments

While working through example 2 with the latest version of Flux, I run into the following error in when launching submitter.py:

bash-4.2$ salloc -N3 -ppdebug
salloc: Granted job allocation 3777140
bash-4.2$ export FLUX_SCHED_OPTIONS='node-excl=true'
bash-4.2$ srun --pty --mpi=none -N3 /g/g0/moussa1/flux-framework/flux-core/src/cmd/flux start -o,-S,log-filename=out
bash-4.2$ ./submitter.py
Traceback (most recent call last):
  File "./submitter.py", line 39, in <module>
    resp = f.rpc_send ("job.submit", payload)
  File "/g/g0/moussa1/flux-framework/flux-core/src/bindings/python/flux/wrapper.py", line 64, in __call__
    self.name, c_name, [p + self.name for p in self.prefixes], args
flux.wrapper.MissingFunctionError: 
A non-existant or unavailable function invocation has been detected.
Has this function been recently removed or renamed?

It looks like rpc_send is no longer a function in the Python bindings (from looking at flux-sched PR #450), and the new function is rpc.get(). I think I'm just unsure how to use this function with how rpc_send was used in this script. Here is the old code:

f = flux.Flux ()
resp = f.rpc_send ("job.submit", payload)
if resp is None:
    print "flux.rpc: compute_jobreq", "failed"

I tried finding documentation on it but I couldn't find any (I'm sorry in advance if it is somewhere and I just didn't look hard enough!)

Maybe I’m not understanding how to use the new rpc function (or maybe I am misunderstanding what a payload actually is); I think I’m running into an empty payload error.

compute_jobreq = {
    'nnodes' : 2,
    'ntasks' : 4,
    'ncores' : 8,
    'cmdline' : ["./compute.py", "120"],
    'environ' : get_environment (),
    'cwd' : os.getcwd (),
    'walltime' : 0,
    'ngpus' : 0,
}

And here’s where I’m using the RPC:

payload = json.dumps(compute_jobreq)
f = flux.Flux ()
resp = f.rpc("job-ingest.submit", payload).get()
if resp is None:
    print "flux.rpc: compute_jobreq", "failed"

This results in the following stack trace:

bash-4.2$ ./submitter.py
Traceback (most recent call last):
  File "./submitter.py", line 39, in <module>
    resp = f.rpc("job-ingest.submit", payload).get()
  File "/g/g0/moussa1/flux-framework/flux-core/src/bindings/python/flux/rpc.py", line 50, in get
    resp_str = self.get_str()
  File "/g/g0/moussa1/flux-framework/flux-core/src/bindings/python/flux/rpc.py", line 44, in get_str
    self.pimpl.flux_rpc_get(payload_str)
  File "/g/g0/moussa1/flux-framework/flux-core/src/bindings/python/flux/util.py", line 41, in func_wrapper
    raise EnvironmentError(error.errno, errmsg.decode("utf-8"))
EnvironmentError: [Errno 71] Protocol error

@cmoussa1: You seem to be correctly using the rpc function. However, you need to update your payload to conform with the new execution system (you are sending an old-style job payload, and therefore are getting a Protocol Error (incorrect payload))

Take a look at the submit method in flux-mini.py for an example of the job-ingest.submit protocol.