Skip to content
This repository was archived by the owner on Oct 21, 2021. It is now read-only.
This repository was archived by the owner on Oct 21, 2021. It is now read-only.

Issue with the calling the sdk/dsl import models error #25

@spolireddy

Description

@spolireddy

Hi all trying to use argo-workflows-sdk, getting this problem with the api, any help would be appreciated from argo.workflows import models
ImportError: cannot import name 'models'example taken from here

from argo.workflows.sdk import Workflow
from argo.workflows.sdk import templatefrom argo.workflows.sdk.templates import V1Containerclass Sample(Workflow):    

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

Calling in to launch this helloworld workflow

import yaml
import requests
from argo.workflows.client import (ApiClient,
                                   WorkflowServiceApi,
                                   Configuration,
                                   V1alpha1WorkflowCreateRequest)

# assume we ran `kubectl -n argo port-forward deployment/argo-server 2746:2746`
from helloworld import Sample
config = Configuration(host="http://localhost:2746")

client = ApiClient(configuration=config)
service = WorkflowServiceApi(api_client=client)

wf = Sample()
manifest = wfservice.create_workflow('argo', V1alpha1WorkflowCreateRequest(workflow=manifest))

The problem is here
Traceback (most recent call last):
File "/Users//Git/datapipeline-api/gg.py", line 9, in
from helloworld import Sample
File "/Users/Git/datapipeline-api/helloworld.py", line 1, in
from argo.workflows.sdk import Workflow
File "/Users/.pyenv/versions/venv36/lib/python3.6/site-packages/argo/workflows/sdk/init.py", line 17, in
from . import tasks
File "/Users//.pyenv/versions/venv36/lib/python3.6/site-packages/argo/workflows/sdk/tasks.py", line 25, in
from ._arguments import artifact
File "/Users//.pyenv/versions/venv36/lib/python3.6/site-packages/argo/workflows/sdk/_arguments.py", line 11, in
from ._base import Prop
File "/Users/.pyenv/versions/venv36/lib/python3.6/site-packages/argo/workflows/sdk/_base.py", line 16, in
from argo.workflows import models
ImportError: cannot import name 'models' (edited)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions