Locked History Actions

attachment:disk_usage_and_job_report.py of Events/GCC2014/TrainingDay/API

Attachment 'disk_usage_and_job_report.py'

Download

   1 #!/usr/bin/env python
   2 
   3 
   4 import sys
   5 import json
   6 import yaml
   7 import requests
   8 
   9 BASE_GALAXY_URL = 'http://localhost:8080'
  10 API_KEY = '225960e27cf51d0a012755a5db11cee1'
  11 
  12 users = requests.get("%s/api/users?key=%s" % (BASE_GALAXY_URL, API_KEY)).json()
  13 
  14 # We have a dictionary of users.
  15 
  16 for user in users:
  17     user_details = requests.get("%s/api/users/%s?key=%s" % (BASE_GALAXY_URL, user['id'], API_KEY))
  18     print user_details.json()
  19 
  20     # We must now impersonate this user, because a user can only query their
  21     # own jobs
  22 
  23     user_jobs = requests.get("%s/api/jobs?key=%s&run_as=%s" % (BASE_GALAXY_URL, API_KEY, user['id'])).json()
  24     print len(user_jobs)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2014-07-20 20:52:44, 281.3 KB) [[attachment:The Galaxy API (GCC2014 TD API).pdf]]
  • [get | view] (2014-07-01 14:55:36, 8.2 KB) [[attachment:api-scripts.completed.tar.gz]]
  • [get | view] (2014-07-01 14:55:22, 8.4 KB) [[attachment:api-scripts.exercises.tar.gz]]
  • [get | view] (2014-07-01 15:06:45, 0.6 KB) [[attachment:disk_usage_and_job_report.py]]
  • [get | view] (2014-07-01 15:07:52, 2.2 KB) [[attachment:install_toolshed_yaml.py]]
  • [get | view] (2014-07-01 15:08:02, 2.3 KB) [[attachment:install_toolshed_yaml_COMPLETE.py]]
  • [get | view] (2014-07-01 15:07:02, 1.4 KB) [[attachment:run_as.dataset_upload.py]]
  • [get | view] (2014-07-01 15:08:22, 2.8 KB) [[attachment:scaffold_user.py]]
  • [get | view] (2014-07-01 15:07:30, 0.1 KB) [[attachment:tools.yaml]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.