CDR Tickets

Issue Number 4672
Summary [Internal] Running FileSweeper From Command Line
Created 2019-10-03 13:59:52
Issue Type Bug
Submitted By Englisch, Volker (NIH/NCI) [C]
Assigned To Kline, Bob (NIH/NCI) [C]
Status Closed
Resolved 2019-12-03 09:43:05
Resolution Fixed
Path /home/bkline/backups/jira/ocecdr/issue.250644
Description

Most of our programs are written to be called as a module or to be run (for testing) from the command line.

The FileSweeper program, part of the scheduled tasks (file_sweeper_task.py), currently fails when run from the command line due to problems with importing local packages.

We want to fix this

Comment entered 2019-12-03 09:43:05 by Kline, Bob (NIH/NCI) [C]
Comment entered 2020-01-23 07:33:20 by Kline, Bob (NIH/NCI) [C]

Please close this ticket when you get a chance to test the script, .

Comment entered 2020-02-03 14:24:53 by Englisch, Volker (NIH/NCI) [C]

I know the run-filesweeper.cmd won't work anymore with the new scheduler but should I be able to run file_sweeper_task.py from the command line?
I'm seeing an error with the relative import of the base_job.Job class.

Comment entered 2020-02-03 14:32:34 by Kline, Bob (NIH/NCI) [C]

Tell me how you're running it.

Comment entered 2020-02-03 14:37:09 by Kline, Bob (NIH/NCI) [C]

Comment entered 2020-02-03 14:47:11 by Englisch, Volker (NIH/NCI) [C]

I'm trying it on the DEV server as well as my DEV WS VM with the same result.
I was trying to run it as
file_sweeper_task.py --help
but your approach
python -m file_sweeper_task.py --help
gives me the same result.

I am in the following directory (on DEV) when I run this
d:\cdr\Scheduler\jobs

Comment entered 2020-02-03 14:49:27 by Kline, Bob (NIH/NCI) [C]

Basically the same technique as was used by run-filesweeper.cmd.

Comment entered 2020-02-03 14:50:41 by Kline, Bob (NIH/NCI) [C]

Move up one directory (again, same approach as was used by run-filesweeper.cmd with the old scheduler).

Comment entered 2020-02-03 15:14:24 by Englisch, Volker (NIH/NCI) [C]

OK, I see now what I did wrong. RTFM

{{ -m: Since the argument is a module name, you must not give a file extension (.py).}}

It's working now.

Comment entered 2020-02-03 16:04:27 by Kline, Bob (NIH/NCI) [C]

Will this help?

 

Attachments
File Name Posted User
image-2020-02-03-14-37-42-784.png 2020-02-03 14:38:13 Kline, Bob (NIH/NCI) [C]
image-2020-02-03-16-03-48-366.png 2020-02-03 16:04:19 Kline, Bob (NIH/NCI) [C]

Elapsed: 0:00:00.001287