Giter Club home page Giter Club logo

Comments (3)

bradmwilliams avatar bradmwilliams commented on September 21, 2024

@jkugler I don't believe you are missing anything. This library is a wrapper written around the oc command and the majority of it was written to provide a rich interaction with OpenShift via the oc command. Because we support both local and remote executions, it's much easier for us to capture everything into our Result class, and then pass that back to the consumer to deal with it, as they see fit.
Everything that you are looking for should be available inside of the Result object returned from whatever Action that you are performing. While the output may not be streaming real-time, it is available immediately after the action completes and can be written to the screen in multiple ways (action.out, action.as_dict(), action.as_json()). Another nice feature of the action.as_*() methods is the ability to redact sensitive information from the output.
Hopefully this helps! If you have any questions, please let us know.

from openshift-client-python.

jkugler avatar jkugler commented on September 21, 2024

Thanks for the answer! I'm trying to move our team to use the Python API, whether it be this API or https://github.com/openshift/openshift-restclient-python instead of directly shelling out to the oc command, in order to better handle errors, etc. But, there is a lot of pushback because we then won't have streaming output for the developers so they can watch the progress, abort if there is a hang, etc.

I saw the restclient version had a watch method on objects, so maybe that will return logs in real time. I need to investigate that.

from openshift-client-python.

bradmwilliams avatar bradmwilliams commented on September 21, 2024

No problem, happy to help!

We do provide error tracking as well as a timeout, on oc actions, that sound like it could be something that you could utilize versus the streaming logging. The following link is to a pretty simple example of both of these features:

with oc.timeout(60 * 30), oc.tracking() as t:
try:
with oc.project('default'):
bc = oc.selector('bc/does-not-exist')
bc.start_build()
except (ValueError, OpenShiftPythonException, Exception):
# Print out exception stack trace via the traceback module
logger.info('Traceback output:\n{}\n'.format(traceback.format_exc()))
# Print out all oc interactions and do not redact secret information
logger.info("OC tracking output:\n{}\n".format(t.get_result().as_json(redact_streams=False)))

from openshift-client-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.