Project

General

Profile

Feature #22164

Upgrade jobsub code to use argparse instead of optparse

Added by Shreyas Bhat 3 months ago. Updated 18 days ago.

Status:
Work in progress
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
03/19/2019
Due date:
% Done:

40%

Estimated time:
Stakeholders:
Duration:

Description

We want to use argparse to get jobsub ready to move to python 3. Some pointers for upgrading optparse to argparse are here:

https://docs.python.org/2.7/library/argparse.html#upgrading-optparse-code

With some playing around, it looks like opts, args = parser.parse_args() in optparse can become args, extras = parser.parse_known_args() pretty easily.


Related issues

Blocks JobSub - Bug #21031: jobsub_submit allows more than one --group argument Work in progress2018-11-29

History

#1 Updated by Shreyas Bhat 3 months ago

  • Blocks Bug #21031: jobsub_submit allows more than one --group argument added

#2 Updated by Shreyas Bhat 2 months ago

  • Status changed from New to Work in progress

#3 Updated by Shreyas Bhat 2 months ago

jobsub_fetchlog, jobsub_submit, and jobsub_q done and tested.

#4 Updated by Shreyas Bhat 2 months ago

jobsub_history done and tested.

#5 Updated by Shreyas Bhat about 2 months ago

  • % Done changed from 0 to 20

jobsub_hold and jobsub_probe_url done and tested.

#6 Updated by Shreyas Bhat about 2 months ago

Rough outline of steps for each client module:

  1. imports (optparse, callbacks, version, etc)
  2. Usage line: %prog --> %(prog)s
  3. optparse --> argparse
  4. OptionParser --> ArgumentParser
  5. version_string: Comment out, add argument for Version_String
  6. opt_group --> client_options
  7. optparse.OptionGroup --> parser.add_argument_group; remove later parser.add_argument_group line
  8. add_option --> add_argument
  9. Change all types from strings to callables (like 'string' should become str)
  10. Change callbacks (action = callback --> action = actual callback class)
  11. Check that there's no "store_true" actions with metavars - argparse doesn't support that
  12. parser.parse_args --> parser.parse_known_args
  13. logSupport.dPrint.....: options --> vars(options)

#7 Updated by Shreyas Bhat about 1 month ago

The rest of the client code is updated, but my dev client/server isn't working as I expected. I assume it's something to do with the incommon/curl issues we'd seen. I'll first rebase the work here off of current master, since I'd need to anyway, and then troubleshoot my dev server.

#8 Updated by Shreyas Bhat 18 days ago

  • % Done changed from 20 to 40

There was a bug in the jobsub_submit_dag code that I fixed. Ready to move onto the server.



Also available in: Atom PDF