Skip to content

Masterless Minion - Unable to query job cache #32834

Closed

Description

@beardedeagle

Description of Issue/Question

When running masterless minion, I am unable to query the job cache. I end up getting an empty response:

# salt-call test.ping
[INFO    ] Determining pillar cache
local:
    True
# salt-call saltutil.runner jobs.list_jobs
[INFO    ] Determining pillar cache
[INFO    ] Runner completed: 20160425103635664870
local:
    ----------
# salt-call saltutil.find_job 20160425103635664870
[INFO    ] Determining pillar cache
local:
    ----------
# salt-call saltutil.find_cached_job 20160425103635664870
[INFO    ] Determining pillar cache
local:
    Local jobs cache directory /var/cache/salt/minion/minion_jobs/20160425103635664870 not found

I do see that the job cache is being populated in /var/cache/salt/master/jobs/ though.

Setup

/etc/salt/minion.d/salt-minion.conf:

file_client: local
cache_jobs: True

Steps to Reproduce Issue

1.) Setup masterless salt
2.) use config above for masterless minion
3.) run the following command: salt-call test.ping
4.) run the following command: salt-call saltutil.runner jobs.list_jobs

Versions Report

# salt-minion --versions-report
Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.13.1.el7.x86_64
         system: CentOS Linux 7.2.1511 Core

Activity

  1. added
    bug
    severity-medium
    Core
    P2
    on Apr 26, 2016
  2. added this to the Approved milestone on Apr 26, 2016
  3. jfindlay commented on Apr 26, 2016

    @jfindlay
    Contributor

    Thanks for reporting, @beardedeagle.

  4. self-assigned this
    on May 2, 2016
  5. modified the milestones: B -3, Approved on May 2, 2016
  6. rallytime commented on May 3, 2016

    @rallytime
    Contributor

    @beardedeagle Just an update here, and some clarifications on your issue. For saltutil.runner, this is expected functionality. The docs for the saltutil.runner function say:

    Execute a runner module (this function must be run on the master)
    

    For the saltutil.find_job function, that is also the expected functionality for a job that has already completed. The find_job function appears to be working correctly at the HEAD of the 2015.8 and 2016.3 branches.

    First, I set a longish-running job:

    root@rallytime:~# salt-call --local test.sleep 30
    

    Then I can check what jobs are running (in a different terminal window):

    root@rallytime:~# salt-call --local saltutil.running
    local:
        |_
          ----------
          fun:
              test.sleep
          jid:
              20160502224212381537
          pid:
              32117
          tgt:
              salt-call
    

    Then I can find that job specifically:

    root@rallytime:~# salt-call --local saltutil.find_job 20160502224212381537
    local:
        ----------
        fun:
            test.sleep
        jid:
            20160502224212381537
        pid:
            32117
        tgt:
            salt-call
    

    But once the original test.sleep has finished, I see the same result you posted (which is expected):

    root@rallytime:~# salt-call --local saltutil.find_job 20160502224212381537
    local:
        ----------
    

    I will add a note to the documentation about this behavior so that is more clear for future users.

    However, I am able to reproduce what you're seeing with saltutil.find_cached_job with a masterless minion. I need to look into that more to see what is going on there. The function appears to be working correctly when using a master/minion set up, but when running functions via salt-call, no jobs are getting populated in the /var/cache/salt/minion/minion_jobs/ directory. Only jobs run via salt are present there.

  7. rallytime commented on May 6, 2016

    @rallytime
    Contributor

    @beardedeagle I have fixed the remaining issue with salt-call jobs not populating the local minion job cache. You can now query for jobs that were generated using salt-call.

    See #33100 for the fix. Here's what the behavior looks like with that change:

    root@rallytime:~# ls /var/cache/salt/minion/minion_jobs/
    root@rallytime:~# salt-call --local test.ping
    local:
        True
    root@rallytime:~# ls /var/cache/salt/minion/minion_jobs/
    20160506200913437960
    root@rallytime:~# salt-call --local saltutil.find_cached_job 20160506200913437960
    local:
        ----------
        fun:
            test.ping
        fun_args:
        id:
            rallytime
        jid:
            20160506200913437960
        retcode:
            0
        return:
            True
    
  8. added
    fixed-pls-verify
    on May 6, 2016
  9. beardedeagle commented on May 9, 2016

    @beardedeagle
    Author

    Excellent. Looking at the pr. Thank you.

  10. added a commit that references this issue on May 9, 2016
    3d13115
  11. added a commit that references this issue on May 10, 2016
    ad607ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CoreP2bugfixed-pls-verifyseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions