salt
                                
                                
                                
                                    salt copied to clipboard
                            
                            
                            
                        Running orchestration jids can not be retrieved
Description of Issue
There doesn't seem to be a direct programmatic way to retrieve a running orchestration jid. There should be.
The use case here is a long-running orchestration triggered by a reactor that needs to be interrupted for some reason by a subsequent orchestration.
Setup
Set up a reactor to trigger a long-running orchestration. Try to find the jid using any existing module.
Master configuration:
reactor:
  - 'my/orch/event':
    - /srv/reactor/my_sleepy_orch.sls
/srv/reactor/my_sleepy_orch.sls:
run_sleepy_orch:
  runner.state.orchestrate:
    - args:
        - mods: orch.sleepy
/srv/salt/orch/sleepy.sls:
be_sleepy:
  salt.function:
    - name: test.sleep
    - tgt: 'minion'
    - arg:
      - 120
Steps to Reproduce Issue
Run salt-call event.send my/orch/event.  Try to find the triggered orchestration jid using something that could be incorporated into a state.
Versions Report
Salt Version:
           Salt: 3000
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  7 2019, 00:51:29)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 5.3.0-40-generic
         system: Linux
        version: CentOS Linux 7.6.1810 Core
                                    
                                    
                                    
                                
ZD-4629
This is also true for salt.runners.jobs.list_jobs If I want to look up previous orchestrations launched by reactors, there is no good way to look these up. I think these two issues are related.
Could this unported PR potentially solve the issue? https://github.com/saltstack/salt/pull/51629
@oeuftete You might want to test this patch https://github.com/saltstack/salt/pull/66007
@oeuftete You might want to test this patch #66007
Thanks @max-arnold. I haven't used Salt for a few years now, though. Hopefully someone else can take a stab at it with the setup I provided back then.