[1.4] Job.run - self.request is None
See original GitHub issueEnvironment
- Python version: 3.9
- Nautobot version: e02bb08e6c2a (v1.4.0rc1)
Steps to Reproduce
- Run a job
- Log self.request
Expected Behavior
self.request is not None
import pprint
class MyJob(Job):
    def run(self, data, commit=False):
        self.log_info(self.request, pprint.pformat(self.request, indent=4))
        ...

Observed Behavior
self.request is None
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (8 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
AttributeError when running database-changing Job from ` ...
In runjob , create a mock Request object via web_request_context and pass that instead of None; Enhance _handle_changed_object to gracefully ...
Read more >Jobs - Nautobot Documentation - To the Core Docs!
Jobs are a way for users to execute custom logic on demand from within the ... to execute the job) are available as...
Read more >Jobs - Nautobot Documentation
Jobs ¶. Jobs are a way for users to execute custom logic on demand from within the Nautobot UI. Jobs can interact directly...
Read more >"dictionary update sequence element #0 has length 1; 2 is ...
I have an error message on Django 1.4:
Read more >How to use sessions | Django documentation
Using sessions in views. When SessionMiddleware is activated, each HttpRequest object – the first argument to any Django view function – will have...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

What is the suggested way of logging the caller (username and ip) without accessing self.request?
This is the only reason why I am using it
@smk4664 I’m not able to replicate that problem on
v1.4.0b1Using your code above I’m able to get the repo to resync even when
self.request = Noneas seen here:If a request isn’t provided to
pull_git_repository_and_refresh_data()I get this error message:Were you able to verify that
pull_git_repository_and_refresh_datawas sending thejob_resultas the 3rd positional arg torefresh_datasource_content()?