Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trhodeos committed Aug 22, 2024
1 parent 1566131 commit 6f67635
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
14 changes: 6 additions & 8 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ def __init__(

self.kubernetes_labels = self._get_kubernetes_labels()
self._workflow_template = self._compile_workflow_template()
self._cronworkflow_template = self._compile_cronworkflow_template()
self._cron_workflow = self._compile_cron_workflow()
self._sensor = self._compile_sensor()

def __str__(self):
return str(self._workflow_template)

def get_cron_workflow_template(self):
return self._cronworkflow_template
def get_cron_workflow(self):
return self._cron_workflow

def get_event_sensor_template(self):
def get_event_sensor(self):
return self._sensor

def deploy(self):
Expand Down Expand Up @@ -350,9 +350,7 @@ def _get_schedule(self):
def schedule(self):
try:
argo_client = ArgoClient(namespace=KUBERNETES_NAMESPACE)
argo_client.schedule_workflow_template(
self.name, self._cronworkflow_template
)
argo_client.schedule_workflow_template(self.name, self._cron_workflow)
# Register sensor.
# Metaflow will overwrite any existing sensor.
sensor_name = ArgoWorkflows._sensor_name(self.name)
Expand Down Expand Up @@ -2619,7 +2617,7 @@ def _heartbeat_daemon_template(self):
)
)

def _compile_cronworkflow_template(self):
def _compile_cron_workflow(self):
return (
CronWorkflow()
.metadata(ObjectMeta().name(self.name))
Expand Down
12 changes: 5 additions & 7 deletions metaflow/plugins/argo/argo_workflows_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def create(
user_namespace=None,
only_workflow_template_json=False,
only_event_sensor_json=False,
only_cron_workflow_template_json=False,
only_cron_workflow_json=False,
authorize=None,
generate_new_token=False,
given_token=None,
Expand Down Expand Up @@ -283,16 +283,14 @@ def create(
)

only_json = (
only_workflow_template_json
or only_event_sensor_json
or only_cron_workflow_template_json
only_workflow_template_json or only_event_sensor_json or only_cron_workflow_json
)
if only_workflow_template_json:
obj.echo_always(str(flow), err=False, no_bold=True)
if only_event_sensor_json:
obj.echo_always(str(flow.get_event_source_template()), err=False, no_bold=True)
if only_cron_workflow_template_json:
obj.echo_always(str(flow.get_cron_workflow_template()), err=False, no_bold=True)
obj.echo_always(str(flow.get_event_source()), err=False, no_bold=True)
if only_cron_workflow_json:
obj.echo_always(str(flow.get_cron_workflow()), err=False, no_bold=True)

if not only_json:
flow.deploy()
Expand Down

0 comments on commit 6f67635

Please sign in to comment.