comparison toolfactory/rgToolFactory2.py @ 100:c749364c2283 draft

Uploaded
author fubar
date Mon, 23 Nov 2020 03:12:37 +0000
parents d4d88d393285
children 557d5f06f213
comparison
equal deleted inserted replaced
99:d4d88d393285 100:c749364c2283
37 import tarfile 37 import tarfile
38 import tempfile 38 import tempfile
39 import time 39 import time
40 40
41 41
42 from bioblend import ConnectionError
42 from bioblend import toolshed 43 from bioblend import toolshed
43 44
44 # import docker 45 # import docker
45 46
46 import galaxyxml.tool as gxt 47 import galaxyxml.tool as gxt
779 ) 780 )
780 repos = ts.repositories.get_repositories() 781 repos = ts.repositories.get_repositories()
781 rnames = [x.get("name", "?") for x in repos] 782 rnames = [x.get("name", "?") for x in repos]
782 rids = [x.get("id", "?") for x in repos] 783 rids = [x.get("id", "?") for x in repos]
783 sto.write(f"############names={rnames} rids={rids}\n") 784 sto.write(f"############names={rnames} rids={rids}\n")
785 sto.write(f"############names={repos}\n")
784 tfcat = "ToolFactory generated tools" 786 tfcat = "ToolFactory generated tools"
785 if self.args.tool_name not in rnames: 787 if self.args.tool_name not in rnames:
786 tscat = ts.categories.get_categories() 788 tscat = ts.categories.get_categories()
787 cnames = [x.get("name", "?").strip() for x in tscat] 789 cnames = [x.get("name", "?").strip() for x in tscat]
788 cids = [x.get("id", "?") for x in tscat] 790 cids = [x.get("id", "?") for x in tscat]
802 tid = res.get("id", None) 804 tid = res.get("id", None)
803 sto.write(f"##########create res={res}\n") 805 sto.write(f"##########create res={res}\n")
804 else: 806 else:
805 i = rnames.index(self.args.tool_name) 807 i = rnames.index(self.args.tool_name)
806 tid = rids[i] 808 tid = rids[i]
807 res = ts.repositories.update_repository( 809 try:
808 id=tid, tar_ball_path=self.newtarpath, commit_message=None 810 res = ts.repositories.update_repository(
809 ) 811 id=tid, tar_ball_path=self.newtarpath, commit_message=None)
810 sto.write(f"#####update res={res}\n") 812 sto.write(f"#####update res={res}\n")
813 except ConnectionError:
814 sto.write("Probably no change to repository - bioblend shed upload failed\n")
811 sto.close() 815 sto.close()
812 816
813 def eph_galaxy_load(self): 817 def eph_galaxy_load(self):
814 """load the new tool from the local toolshed after planemo uploads it""" 818 """load the new tool from the local toolshed after planemo uploads it"""
815 if os.path.exists(self.tlog): 819 if os.path.exists(self.tlog):
1239 retcode = r.run() 1243 retcode = r.run()
1240 r.moveRunOutputs() 1244 r.moveRunOutputs()
1241 r.makeToolTar() 1245 r.makeToolTar()
1242 else: 1246 else:
1243 r.makeToolTar() 1247 r.makeToolTar()
1244 #r.planemo_shedLoad() 1248 r.planemo_shedLoad()
1245 r.shedLoad() 1249 r.shedLoad()
1246 r.eph_galaxy_load() 1250 r.eph_galaxy_load()
1247 retcode = r.gal_tool_test() # writes outputs 1251 retcode = r.gal_tool_test() # writes outputs
1248 r.makeToolTar() 1252 r.makeToolTar()
1249 #r.planemo_shedLoad() 1253 r.planemo_shedLoad()
1250 r.shedLoad() 1254 r.shedLoad()
1251 r.eph_galaxy_load() 1255 r.eph_galaxy_load()
1252 retcode = r.gal_test() 1256 retcode = r.gal_test()
1253 r.moveRunOutputs() 1257 r.moveRunOutputs()
1254 r.makeToolTar() 1258 r.makeToolTar()