kbase / kb_sdk

Build and test new apps for the KBase platform
http://kbase.github.io/kb_sdk_docs
MIT License
27 stars 32 forks source link

Add "Hello World" example to basic init #329

Closed JamesJeffryes closed 6 years ago

JamesJeffryes commented 6 years ago

OK, this was more painful than expected but you should be able to initialize Python, Perl and Java modules and run kb-sdk test to produce a hello world report.

psdehal commented 6 years ago

so the behavior now would be that kb-sdk init creates a run_module function in the impl file that prints "hello world"

On Wed, Oct 31, 2018 at 2:20 PM James Jeffryes notifications@github.com wrote:

OK, this was more painful than expected but you should be able to initialize Python, Perl and Java modules and run kb-sdk test to produce a hello world report.

You can view, comment on, or merge this pull request online at:

https://github.com/kbase/kb_sdk/pull/329 Commit Summary

  • convert files to be compatible with python3
  • fix ERR_CONTENT_LENGTH_MISMATCH
  • more tweaks
  • more python3 cleanup
  • Merge remote-tracking branch 'origin/develop' into python3
  • Add dependency tracking with pipenv
  • Add note in the README.md about using pipenv
  • Get flake8 linter passing on python code, including test_scripts/*/.py
  • Remove test print line
  • Alter makefile to prevent python/js/perl/R client generation; move java flags into the java language condition.
  • Merge pull request #1 from jayrbolton/python3
  • Add temp_test* into the flake8 ignores
  • Add a test-python target/command to the Makefile for convenience
  • Add some more pipenv-related documentation to the readme
  • Prevent a flake8 error in authclient.py
  • Remove --java flag as it is unnecessary when combined with --javasrv
  • Merge pull request #2 from jayrbolton/python3
  • Sync up the changes from njs_wrapper for CallbackServerConfigBuilder and SubsequentCallRunner
  • Merge branch 'develop' into python3
  • Merge branch 'develop' into python3
  • Merge branch 'python3' of https://github.com/JamesJeffryes/kb_sdk into python3
  • Add python 2 and 3 setup and pip installation commands in Vagrantfile
  • Replace Pipfile/pipenv with a requirements.txt -- pipenv is not necessary with vagrant
  • Add vagrant-based make targets for testing both python2 and python3
  • Ignore env-*/
  • Merge branch 'develop' into python3
  • Merge branch 'develop' into refdata-fixes
  • Sync up src with latest from njs
  • Update docker base images
  • revert unnessisary auth addition
  • update stringIO call
  • Merge pull request #315 from JamesJeffryes/python3
  • remove -user $(id -u) setting which causes issues running local tests
  • Clean up python test template, esp. make tests use installed WS
  • Merge pull request #321 from JamesJeffryes/SCT-1193
  • Add a line to test script run in docker container to remove any lingering files in the scratch space
  • remove what local files we can before building the image
  • Note that temp files are being cleaned
  • Merge pull request #320 from JamesJeffryes/PUBLIC-436
  • make sure temp folder itself is not removed in cleaning
  • bump version and add release notes
  • Merge pull request #322 from JamesJeffryes/new_version
  • avoid use of "message" attribute in exceptions
  • use "repr" instead of "str" to ensure that the error type is retained
  • Merge pull request #323 from JamesJeffryes/tweak_server_exception
  • Don't auto-generate clients for each language in the wrong place
  • Installed clients in perl, r and python go into a installed_clients folder
  • Make init have default impl that accepts a param dict and returns report refs. Renames "examplemodule" to "run"
  • Merge pull request #1 from JamesJeffryes/PR-316
  • Same for Java. Kinda confused why it wasn't need to update the imports but I guess that the clients are compiling to the same location?
  • Catch another exception type associated with BADSTATUSCODE
  • Merge pull request #316 from jayrbolton/dont-generate-unnecessary-client-code
  • Merge pull request #317 from jayrbolton/refdata-fixes
  • Merge pull request #328 from JamesJeffryes/SCT-1366
  • fix text, make into mapping, pass woerkspace_id
  • Merge pull request #326 from JamesJeffryes/SCT-1585
  • Merge pull request #327 from JamesJeffryes/SCT-1586
  • Add helloworld method for each language to each app

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kbase/kb_sdk/pull/329, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0y9OHq14E5JVskWElZuKHhJ7UcaCbtks5uqhQcgaJpZM4YFQDC .

JamesJeffryes commented 6 years ago

Actually the created report says "Hello World" (in the test) or what ever you specify in "parameter_1"

jayrbolton commented 6 years ago

Testing and looking through things

jayrbolton commented 6 years ago

There was an issue with the Java test that I commented about above. The perl version seems to work fine (although I can't make heads or tails of that test file, wowzers). The python version throws an error for me:

Traceback (most recent call last):
  File "/miniconda/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/miniconda/lib/python3.6/site-packages/nose/loader.py", line 523, in makeTest
    return self._makeTest(obj, parent)
  File "/miniconda/lib/python3.6/site-packages/nose/loader.py", line 582, in _makeTest
    return MethodTestCase(obj)
  File "/miniconda/lib/python3.6/site-packages/nose/case.py", line 346, in __init__
    self.inst = self.cls()
TypeError: __init__() missing 1 required positional argument: 'config'

@JamesJeffryes any ideas? It seems to run the actual test method before the error is raised. I can't tell how or where it gets raised.

JamesJeffryes commented 6 years ago

So the Java issue was some bad copy pasta that I missed because I kept using "javafoo" as my module name. I actually can't replicate the Python error you are seeing though. Do you see it when you init with the -e flag too?

jayrbolton commented 6 years ago

It looks like default tests do work on the filter contigs example, but I still get the above error on the hello world example

jayrbolton commented 6 years ago

I finally found the cause of the python error. It's pretty obscure and probably not related to this update.

I was calling my modules "test_python_hello_worldetc". That "test" prefix on the module name was causing nose2 to do something weird with it. When I rename my module to python_hello_world, it is fixed. Something to note on the troubleshooting page I guess.