Skip to content

Commit

Permalink
Updates to work on Local FOQUS
Browse files Browse the repository at this point in the history
  • Loading branch information
boverhof committed Aug 25, 2022
1 parent ff6beec commit 628d272
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
4 changes: 2 additions & 2 deletions turbine/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ def add_options(op):

# Paging
op.add_option("-p", "--page", type="int",
action="store", dest="page", default=0,
action="store", dest="page", default=None,
help="page number")
op.add_option("-r", "--rpp", type="int",
action="store", dest="rpp", default=1000,
action="store", dest="rpp", default=None,
help="results per page")
op.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
Expand Down
8 changes: 6 additions & 2 deletions turbine/commands/requests_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ def read_configuration(configFile, section, **kw):
verbose = params.get('verbose', False)
assert type(verbose) is bool
rpp = params.get('rpp', '0')
assert type(int(rpp)) is int
if rpp is None:
del params['rpp']
assert rpp is None or type(int(rpp)) is int
pagenum = params.get('page', '0')
assert type(int(pagenum)) is int
if pagenum is None:
del params['page']
assert pagenum is None or type(int(pagenum)) is int
auth = (configFile.get('Authentication', 'username', raw=True),
configFile.get('Authentication', 'password', raw=True))

Expand Down
18 changes: 13 additions & 5 deletions turbine/commands/turbine_consumer_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
import dateutil.parser
import datetime
from urllib.error import HTTPError
from turbine.commands import add_options, post_page, put_page, \
get_page, get_page_by_url, get_paging, _open_config, load_pages_json, \
_print_page, _print_numbered_lines, add_json_option, _print_as_json


# from turbine.commands import add_options, post_page, put_page, \
# get_page, get_page_by_url, get_paging, _open_config, load_pages_json, \
# _print_page, _print_numbered_lines, add_json_option, _print_as_json

from .requests_base import get_page, put_page, delete_page, post_page,\
get_page_by_url, read_configuration,\
RequestException, HTTPError, ConnectionError
from . import add_options,\
_open_config, load_pages_json, _print_page,\
_print_page, _print_numbered_lines, _print_as_json,\
getFromConfigWithDefaults,\
HEADER_CONTENT_TYPE_JSON

SECTION = "Consumer"


Expand Down
13 changes: 10 additions & 3 deletions turbine/commands/turbine_session_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,20 @@ def main_list(args=None):

func = _print_as_json
query = dict(page=options.page, rpp=options.rpp)
pages = []
pages.append(get_page(configFile, SECTION, **query))
data = load_pages_json(pages)
data = list_session(configFile, **query)
if func:
func(data)
return data

def list_session(configFile, **kw):
""" returns Array of Session GUIDS
"""
pages = []
pages.append(get_page(configFile, SECTION, **kw))
data = load_pages_json(pages)
return data


def main_session_status(args=None, func=_print_as_json):
"""session resource utility, lists all jobs states of session resource
"""
Expand Down

0 comments on commit 628d272

Please sign in to comment.