Giter Club home page Giter Club logo

Comments (8)

yxue-kabam avatar yxue-kabam commented on May 31, 2024 6

I cannot speak for the author whether this is the correct way, seeing both libraries is under active development (especially this one), I'd expect a better installation process in the future.

What I did to get it working: (should not be a reliable way)

start a new virtual env,

pip install -U git+git://github.com/CermakM/argo-client-python.git
pip install -U git+git://github.com/CermakM/argo-python-dsl.git

from argo-python-dsl.

brtasavpatel avatar brtasavpatel commented on May 31, 2024 2

sorry guys to bombard you all with questions, I have one more question.
how can I specify which Service Account to use when I submit a workflow?
for eg with argo cli I can do

argo submit --serviceaccount my-serviceaccount --watch https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml

how can I specify service account? either in dsl or create_namespaced_workflow?

if anyone else is wondering about this one. I got it to work using @CermakM 's help.

here's how you can do that, specify service_account_name in Workflow class.

class HelloWorld(Workflow):
    entrypoint = "whalesay"
    service_account_name = "argo-workflow"

    @template
    def whalesay(self):
        container = V1Container(
            image="docker/whalesay:latest",
            name="whalesay",
            command=["cowsay"],
            args=["hello world"]
        )
        return container

from argo-python-dsl.

brtasavpatel avatar brtasavpatel commented on May 31, 2024 1

again thanks a lot @CermakM for great work. :-)

from argo-python-dsl.

yxue-kabam avatar yxue-kabam commented on May 31, 2024

Hi, can you uninstall argo-models and install argo-client-python ?
pip install -U git+git://github.com/CermakM/argo-client-python.git

What I have is different than yours:

argo-workflows     3.0.0rc0
argo-workflows-dsl 0.1.0.dev0

I am not sure what is argo-models project though.

here is the code successfully submit the hello-world example for me.

from argo.workflows.client import V1alpha1Api

from argo.workflows.config import load_kube_config

from argo.workflows.dsl import Workflow
from argo.workflows.dsl import template

from argo.workflows.dsl.templates import V1Container
from argo.workflows.config import load_kube_config

load_kube_config()

api = V1alpha1Api()

class HelloWorld(Workflow):

    entrypoint = "whalesay"

    @template
    def whalesay(self) -> V1Container:
        container = V1Container(
            image="docker/whalesay:latest",
            name="whalesay",
            command=["cowsay"],
            args=["hello world"]
        )

        return container

wf = HelloWorld()
print(wf)
result = api.create_namespaced_workflow('argo', wf)
print(result.metadata.name)


from argo-python-dsl.

brtasavpatel avatar brtasavpatel commented on May 31, 2024

how did you install argo-workflows-dsl though? I cloned master branch and did python setup.py install is that the correct way to install?

from argo-python-dsl.

CermakM avatar CermakM commented on May 31, 2024

@yxue-kabam That is exactly right and thanks for the active participation.

The client library has already been released to PyPI: https://pypi.org/project/argo-workflows/,
so it can be installed directly as pip install -U argo-workflows.

The DSL, however, is indeed under active development and it is currently 'safer' to install it from github directly.

@brtasavpatel does the problem with the import persist? As far as the other issue is concerned, I commented right there :)

PS: argo-models are not my doing and are not related to this library

from argo-python-dsl.

brtasavpatel avatar brtasavpatel commented on May 31, 2024

thanks @yxue-kabam and @CermakM for the replies, I think because of that argo-models package I had some module name conflicts that's why it wasn't working,

code snippet above works, though there's one issue with that (I don't know if it's intentional)
when I try to submit same workflow twice I get

ApiException: (500)
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Date': 'Wed, 26 Feb 2020 22:32:48 GMT', 'Content-Length': '286'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"The POST operation against Workflow.argoproj.io could not be completed at this time, please try again.","reason":"ServerTimeout","details":{"name":"POST","group":"argoproj.io","kind":"Workflow"},"code":500}

Here this exception is totally misleading. I have investigated and found out that it's failing because argo doesn't allow same names for the workflows. if I set workflow name to empty string like this : wf.name = '' I can submit the workflow multiple times.

I wanted to know Is this an intended behavior?

from argo-python-dsl.

brtasavpatel avatar brtasavpatel commented on May 31, 2024

sorry guys to bombard you all with questions, I have one more question.
how can I specify which Service Account to use when I submit a workflow?
for eg with argo cli I can do

argo submit --serviceaccount my-serviceaccount --watch https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml

how can I specify service account? either in dsl or create_namespaced_workflow?

from argo-python-dsl.

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.