Comments (3)
@yxue-kabam whatever is set as a property to the Workflow
becomes part of the WorkflowSpec
if that property is valid according to the OpenAPI specification of WorkflowSpec
. That being said, @brtasavpatel 's approach is correct, setting affinity
property of the Workflow makes part of the workflow.spec.affinity
.
Unfortunately, that particular property is really annoyingly nested :/ not much we can do here, tho, as this is the specification of it.
from argo-python-dsl.
I think I found out how to use those, this is an example below, but it seems to have a lot of nested classes which needs to be initiated just to set Affinity. Am I doing it correctly?
from argo.workflows.client import V1alpha1Api
from argo.workflows.dsl import Workflow
from argo.workflows.dsl.tasks import *
from argo.workflows.dsl.templates import *
from kubernetes.client.models import V1Toleration, V1Affinity, V1NodeAffinity, V1NodeSelector, \
V1NodeSelectorTerm
class TestWorkflow(Workflow):
service_account_name = 'argo-workflow'
node_selector = V1NodeSelector(
node_selector_terms=[
V1NodeSelectorTerm(
match_expressions={"key": "app", "operator": "In", "values": ["job"]}),
V1NodeSelectorTerm(
match_expressions={"key": "worker", "operator": "In", "values": ["default"]}),
])
node_affnity = V1NodeAffinity(required_during_scheduling_ignored_during_execution=node_selector)
affinity = V1Affinity(node_affnity)
tolerations = [V1Toleration(
key="app",
operator="Equal",
value="job",
effect="NoSchedule"
)]
from argo-python-dsl.
@brtasavpatel tolerations and affinity should go to top level workflow spec
see https://github.com/CermakM/argo-client-python/blob/0caa743442d37f2f2e3b30867398ed2708c1bf4d/argo/workflows/client/models/v1alpha1_workflow_spec.py#L59
you are making progress, but currently there is no direct support from the dsl that can help you set those attr directly from within the class.
Once you have the workflow object from TestWorkflow()
, try this
workflow.spec.toleration = ...
workflow.spec.affinity = ...
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
- 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
- submit failed, prompt "argo.workflows.client.rest.ApiException: (400)" HOT 6
- 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.