def errorcheck(res): if 'error' in res: paperspace.print_json_pretty(res) sys.exit(1)
# Tests: project = 'all' print('project: %s' % project) def errorcheck(res): if 'error' in res: paperspace.print_json_pretty(res) sys.exit(1) print("paperspace.jobs.machineTypes()") machineTypes = paperspace.jobs.machineTypes() errorcheck(machineTypes) paperspace.print_json_pretty(machineTypes) print("paperspace.jobs.list({'project': '%s'})" % project) jobs = paperspace.jobs.list({'project': project}) errorcheck(jobs) for job in jobs: print(job['id']) print("jobs.create({'project': '%s', 'machineType': 'P5000', 'container': 'paperspace/tensorflow-python', 'command': './do.sh', 'workspace': '~/myproject3'})" % project) job = paperspace.jobs.create({'project': project, 'machineType': 'P5000', 'container': 'paperspace/tensorflow-python', 'command': './do.sh', 'workspace': '~/myproject3'}) if 'error' in job: sys.exit(1) jobId = job['id']
import sys import paperspace if not paperspace.login(): sys.exit(1) print("paperspace.jobs.list({'project': 'all'})") jobs = paperspace.jobs.list({'project': 'all'}) if 'error' in jobs: paperspace.print_json_pretty(jobs) else: for job in jobs: print(job['id'])
import sys import time import paperspace def errorcheck(res): if 'error' in res: paperspace.print_json_pretty(res) sys.exit(1) """ print("paperspace.machines.availability({'region': 'East Coast (NY2)', 'machineType': 'P4000'})") res = paperspace.machines.availability({'region': 'East Coast (NY2)', 'machineType': 'P4000'}) errorcheck(res) paperspace.print_json_pretty(res) print("paperspace.networks.list()") networks = paperspace.networks.list() if 'error' in res: paperspace.print_json_pretty(res) else: for network in networks: paperspace.print_json_pretty(network) print("paperspace.templates.list()") templates = paperspace.templates.list() errorcheck(templates) for template in templates: paperspace.print_json_pretty(template) print("paperspace.users.list()") users = paperspace.users.list() errorcheck(users)
import paperspace files = paperspace.jobs.artifactsGet( { 'jobId': 'jsrsmgaq3iqbbj', 'dest': '~/dk_ps/deepknockoff_grf/ps_files' }, no_logging=True) paperspace.print_json_pretty(files)