Comments (6)
I have the same error using Minikube.
from argo-python-dsl.
This small hack fixed it for me:
# Current hack to make it work: should be fixed soon
manifest = wk.to_dict()
manifest["apiVersion"] = "argoproj.io/v1alpha1"
manifest["kind"] = "Workflow"
from argo-python-dsl.
This small hack fixed it for me:
# Current hack to make it work: should be fixed soon manifest = wk.to_dict() manifest["apiVersion"] = "argoproj.io/v1alpha1" manifest["kind"] = "Workflow"
could you show me full code? i can't get how to submit by python dsl
from argo-python-dsl.
Here it is:
import secrets
from argo.workflows.client import V1alpha1Api
from argo.workflows.config import load_kube_config
from argo.workflows.dsl import Workflow
from argo.workflows.dsl.tasks import task, dependencies
from argo.workflows.dsl.templates import parameter
from argo.workflows.dsl.templates import inputs
from argo.workflows.dsl.templates import template
from argo.workflows.dsl.templates import V1alpha1Parameter
from argo.workflows.dsl.templates import V1alpha1Template
from argo.workflows.dsl.templates import V1Container
# Define your workflow
class DagDiamond(Workflow):
@task
@parameter(name="message", value="A")
def A(self, message: V1alpha1Parameter) -> V1alpha1Template:
return self.echo(message=message)
@task
@parameter(name="message", value="B")
@dependencies(["A"])
def B(self, message: V1alpha1Parameter) -> V1alpha1Template:
return self.echo(message=message)
@task
@parameter(name="message", value="C")
@dependencies(["A"])
def C(self, message: V1alpha1Parameter) -> V1alpha1Template:
return self.echo(message=message)
@task
@parameter(name="message", value="D")
@dependencies(["B", "C"])
def D(self, message: V1alpha1Parameter) -> V1alpha1Template:
return self.echo(message=message)
@template
@inputs.parameter(name="message")
def echo(self, message: V1alpha1Parameter) -> V1Container:
container = V1Container(
image="alpine:3.7",
name="echo",
command=["echo", "{{inputs.parameters.message}}"],
)
return container
# Create a workflow
wk = DagDiamond()
# Load the API to communicate with the cluster
load_kube_config()
v1alpha1 = V1alpha1Api()
# Current hack to make it work: should be fixed soon
manifest = wk.to_dict()
manifest["apiVersion"] = "argoproj.io/v1alpha1"
manifest["kind"] = "Workflow"
manifest["metadata"]["name"] += secrets.token_hex(5)
manifest["spec"]["serviceAccountName"] = "argo"
# Submit the workflow to the cluster
sub_wk = v1alpha1.create_namespaced_workflow(namespace="argo", body=manifest)
# List workflows (executed or not)
wfs = v1alpha1.list_namespaced_workflows(namespace="argo")
print(f"{len(wfs.items)} workflows on the cluster.")
from argo-python-dsl.
Here it is:
import secrets from argo.workflows.client import V1alpha1Api from argo.workflows.config import load_kube_config from argo.workflows.dsl import Workflow from argo.workflows.dsl.tasks import task, dependencies from argo.workflows.dsl.templates import parameter from argo.workflows.dsl.templates import inputs from argo.workflows.dsl.templates import template from argo.workflows.dsl.templates import V1alpha1Parameter from argo.workflows.dsl.templates import V1alpha1Template from argo.workflows.dsl.templates import V1Container # Define your workflow class DagDiamond(Workflow): @task @parameter(name="message", value="A") def A(self, message: V1alpha1Parameter) -> V1alpha1Template: return self.echo(message=message) @task @parameter(name="message", value="B") @dependencies(["A"]) def B(self, message: V1alpha1Parameter) -> V1alpha1Template: return self.echo(message=message) @task @parameter(name="message", value="C") @dependencies(["A"]) def C(self, message: V1alpha1Parameter) -> V1alpha1Template: return self.echo(message=message) @task @parameter(name="message", value="D") @dependencies(["B", "C"]) def D(self, message: V1alpha1Parameter) -> V1alpha1Template: return self.echo(message=message) @template @inputs.parameter(name="message") def echo(self, message: V1alpha1Parameter) -> V1Container: container = V1Container( image="alpine:3.7", name="echo", command=["echo", "{{inputs.parameters.message}}"], ) return container # Create a workflow wk = DagDiamond() # Load the API to communicate with the cluster load_kube_config() v1alpha1 = V1alpha1Api() # Current hack to make it work: should be fixed soon manifest = wk.to_dict() manifest["apiVersion"] = "argoproj.io/v1alpha1" manifest["kind"] = "Workflow" manifest["metadata"]["name"] += secrets.token_hex(5) manifest["spec"]["serviceAccountName"] = "argo" # Submit the workflow to the cluster sub_wk = v1alpha1.create_namespaced_workflow(namespace="argo", body=manifest) # List workflows (executed or not) wfs = v1alpha1.list_namespaced_workflows(namespace="argo") print(f"{len(wfs.items)} workflows on the cluster.")
thanks very much, i got sucess also
from argo-python-dsl.
should probably be solved here https://github.com/argoproj-labs/argo-python-dsl
Also pypi argo-python-dsl now points to the community maintained release
from argo-python-dsl.
Related Issues (20)
- Host as part of Argo Labs HOT 10
- Development plan and contribution HOT 3
- Dynamic Template & Task generation
- how to use V1Volume, V1Toleration etc? HOT 3
- workflow.from_url is not taking `url` HOT 1
- Missing kind and other metadata HOT 3
- [Discussion] Dynamic task generation HOT 2
- AttributeError: 'dependencies' object has no attribute 'model' HOT 4
- new install from master - as require the full body posted on submit HOT 6
- Would you consider integration with the component format of Kubeflow Pipelines?
- how to set pod-metadata HOT 2
- how to use with_param decorator HOT 2
- Nested DAGs HOT 1
- Functional API? HOT 3
- Argo Python SDK -> to Argo Python DSL
- Documentation comparing to Kubeflow Pipelines Python SDK
- cannot import name 'models' from 'argo.workflows' HOT 8
- Workflow metadata name parsed from class name prevents generated name from working HOT 2
- AttributeError: 'NoneType' object has no attribute 'parameters' from Workflow.submit() HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argo-python-dsl.