Repository navigation
tig-cli: Python API for running VICAR programs in the container - #46
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
devin-ai-integration[bot] wants to merge 3 commits into
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Tig.run(tool, *args, **params) execs a program in the same warm container the tig command uses, with stdout/stderr captured, and returns a Result carrying the exit code, the output text and the host paths of the files named in the arguments that the run created or changed. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
Original prompt from jason.han
|
… TIG_EXEC_ID Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
tig_cli.apiso VICAR programs can be run from Python in the TIG container, with their output returned to the caller instead of streamed to the terminal:Design points that aren't obvious from the code:
TigwrapsContainerManager(config layering, image/runtime selection, mounts, calibration, claims,PathTranslator) and issues its ownruntime exec -w <cwd> -e DISPLAY -e TIG_EXEC_ID …viasubprocess.run(capture_output=True). It deliberately does not go throughfast.run/dispatch, which are built around handing the tool the caller's terminal. A script and a shell therefore share one warm container, andtig --shutdownstill applies.Result.outputsis computed by fingerprinting (mtime_ns, size) every path-like value in the arguments before and after the run (positional args,k=vvalues,(a,b)lists; flags skipped) and reporting the ones created or changed, as hostPaths. Files a tool names on its own (e.g.marsmesh's.mtl) aren't listed but are inworkdir.workdiris aTig()setting, notos.getcwd().build_mountsonly mounts the process cwd rw, soTigappends itsworkdirtowritable_pathsand translates it forexec -w.check=True/.check()opt in toVicarError.timeout=kills the client and then the in-container process tree viakill_tree_command(TIG_EXEC_ID, SIGKILL), raisingVicarTimeoutwith partial output.tig_cli/__init__.pyexportsTig,Result,VicarError,VicarTimeout,runthrough a module__getattr__so the CLI fast path doesn't pay for importing the API.Tests:
tests/test_api.py(49, offline,FakeRuntime+ a scripted stand-in forsubprocess.runthat writes files so output tracking is exercised) andtests/integration/test_api.py(8, against the real image: gen → label → vicario pipeline,/hosttranslation, stdin/env, timeout kill, container sharing across handles). Both pass locally; the fullpytest -m "not integration"suite is green (467).README: new "Python API" section in
tig-cli/README.md, one-line mention in the root README.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/477ff427de644f99bbf15a28107e6cf3
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/477ff427de644f99bbf15a28107e6cf3?variant=devin
Requested by: @HuiJun