diff --git a/nb2workflow/galaxy.py b/nb2workflow/galaxy.py index ff616cf..4b3b88e 100644 --- a/nb2workflow/galaxy.py +++ b/nb2workflow/galaxy.py @@ -6,6 +6,7 @@ from textwrap import dedent import argparse import logging +import requests import yaml import json @@ -16,7 +17,6 @@ import nbformat from nbconvert.exporters import ScriptExporter -from ensureconda.api import ensureconda import subprocess as sp import bibtexparser as bib @@ -476,13 +476,25 @@ def _parse_requirements_txt(filepath): return reqs_str_list @staticmethod - def _get_micromamba_binary(): - mamba_bin = ensureconda(no_install=False, - micromamba=True, - mamba=False, - conda=False, - conda_exe=False) - return mamba_bin + def _get_micromamba_binary(): + micromamba_dir = os.path.join( + os.environ.get('HOME', os.getcwd()), + '.local', + 'bin' + ) + os.makedirs(micromamba_dir, exist_ok=True) + mambapath = os.path.join(micromamba_dir, 'micromamba') + + if not os.path.isfile(mambapath): + release_url="https://github.com/mamba-org/micromamba-releases/releases/download/1.5.10-0/micromamba-linux-64" + res = requests.get(release_url, allow_redirects=True) + with open(mambapath, 'wb') as fd: + fd.write(res.content) + + if not os.access(mambapath, os.X_OK): + os.chmod(mambapath, 0o744) + + return mambapath def _split_bibfile(filepath): # parse bibfile and return only entries (no preamble/comments/strings) as list of strings diff --git a/nb2workflow/service.py b/nb2workflow/service.py index b8cf90d..92454b7 100644 --- a/nb2workflow/service.py +++ b/nb2workflow/service.py @@ -26,6 +26,7 @@ import tempfile import nbformat import yaml +import traceback from io import BytesIO from bs4 import BeautifulSoup @@ -153,7 +154,7 @@ def run(self): try: self._run() except Exception as e: - logger.error("run failed unexplicably: %s", repr(e)) + logger.error("run failed inexplicably: %s\n%s", repr(e), traceback.format_exc()) app.async_workflows[self.key] = dict( output={}, exceptions=[serialize_workflow_exception(e)] diff --git a/setup.py b/setup.py index 88cc7f9..3f96eee 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,6 @@ 'Jinja2' ], 'galaxy':[ - 'ensureconda', 'bibtexparser >= 2.0.0b3', 'pypandoc_binary', 'black', diff --git a/tests/test_service.py b/tests/test_service.py index ac1fdf0..1e79eed 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -172,5 +172,7 @@ def test_worker_run(): test_worker_thread.join() + logger.info("output has keys: %s", list(r.json['data']['output'])) + open("output.png","wb").write(base64.b64decode(r.json['data']['output']['spectrum_png_content'])) - \ No newline at end of file +