mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Merge pull request #6478 from martenson/telescope-logging
GRT: fix the upload logging init
This commit is contained in:
@@ -135,7 +135,7 @@ def main(argv):
|
||||
help="Set the logging level", default='warning')
|
||||
parser.add_argument("-b", "--batch-size", type=int, default=1000,
|
||||
help="Batch size for sql queries")
|
||||
parser.add_argument("-m", "--max-records", type=int, default=0,
|
||||
parser.add_argument("-m", "--max-records", type=int, default=5000000,
|
||||
help="Maximum number of records to include in a single report. This option should ONLY be used when reporting historical data. Setting this may require running GRT multiple times to capture all historical logs.")
|
||||
populate_config_args(parser)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
grt:
|
||||
# Register at https://telescope.galaxyproject.org to obtain an Instance ID and API key
|
||||
instance_id:
|
||||
api_key:
|
||||
instance_id:
|
||||
api_key:
|
||||
|
||||
# Galaxy Project offers a public galactic-radio-telescope instance, however
|
||||
# you are free to run your own if you need. We would love it if you were
|
||||
|
||||
+12
-5
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
"""Script for submitting Galaxy job information to the Galactic radio telescope.
|
||||
"""Script for submitting Galaxy job information to the Galactic Radio Telescope.
|
||||
|
||||
See doc/source/admin/grt.rst for more detailed usage information.
|
||||
"""
|
||||
@@ -24,14 +24,16 @@ def main(argv):
|
||||
default=default_config)
|
||||
parser.add_argument("-l", "--loglevel", choices=['debug', 'info', 'warning', 'error', 'critical'],
|
||||
help="Set the logging level", default='warning')
|
||||
|
||||
args = parser.parse_args()
|
||||
logging.getLogger().setLevel(getattr(logging, args.loglevel.upper()))
|
||||
|
||||
logging.info('Loading GRT configuration...')
|
||||
try:
|
||||
with open(args.grt_config) as handle:
|
||||
config = yaml.safe_load(handle)
|
||||
except Exception:
|
||||
logging.info('Using default GRT configuration')
|
||||
logging.warning('Using default GRT configuration')
|
||||
with open(sample_config) as handle:
|
||||
config = yaml.safe_load(handle)
|
||||
|
||||
@@ -46,10 +48,12 @@ def main(argv):
|
||||
}
|
||||
r = requests.post(GRT_URL + 'api/whoami', headers=headers)
|
||||
data = r.json()
|
||||
# we get back some information about which reports had previously been uploaded.
|
||||
# Get back some information about which reports had previously been uploaded.
|
||||
remote_reports = data['uploaded_reports']
|
||||
# so now we can know which to send.
|
||||
logging.debug("Remote reports: %s", remote_reports)
|
||||
local_reports = [x.strip('.json') for x in os.listdir(REPORT_DIR) if x.endswith('.json')]
|
||||
logging.debug("Local reports: %s", local_reports)
|
||||
# Now we know which to send.
|
||||
for report_id in local_reports:
|
||||
if report_id not in remote_reports:
|
||||
logging.info("Uploading %s", report_id)
|
||||
@@ -61,7 +65,10 @@ def main(argv):
|
||||
'identifier': report_id
|
||||
}
|
||||
r = requests.post(GRT_URL + 'api/v2/upload', files=files, headers=headers, data=data)
|
||||
logging.info("Uploaded successfully", report_id)
|
||||
if r.ok:
|
||||
logging.info("Uploaded successfully %s", report_id)
|
||||
else:
|
||||
logging.critical("Non-OK response: %s", r.status_code)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user