Skip to content

Commit

Permalink
Revert "When writing to stdout from the pipelines subcommand, we shou…
Browse files Browse the repository at this point in the history
…ld be more SIGPIPE friendly. These changes allow for a cleaner output from `jetstream pipelines -v pipeline@v1.0.0 | head`."

This reverts commit af24a18. Previous commit failed pytest and this isn't in the scope of the features for this branch.
  • Loading branch information
bryce-turner committed Oct 11, 2023
1 parent af24a18 commit 9460208
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions jetstream/cli/subcommands/pipelines.py
Expand Up @@ -10,7 +10,6 @@
For complete option listing see "jetstream run" """
import logging
import sys
import errno
import jetstream
from jetstream.cli.subcommands import run_common_options, run

Expand Down Expand Up @@ -43,28 +42,20 @@ def main(args):
searchpath = args.search_path
else:
searchpath = jetstream.settings['pipelines']['searchpath'].get()
searchpath = searchpath.split(':')
searchpath = searchpath.split(':')

# load and describe pipeline
if args.verbose and args.pipeline:
# Direct pipeline path given, just load and show details
ctx = args.pipeline.get_context()
try:
jetstream.utils.dump_yaml(ctx, sys.stdout)
except IOError as e:
if e.errno == errno.EPIPE:
pass
jetstream.utils.dump_yaml(ctx, sys.stdout)
elif args.verbose and args.name:
# Find a pipeline and show details
pipeline, *version = args.name.rsplit('@', 1)
version = next(iter(version), None)
args.pipeline = jetstream.get_pipeline(pipeline, version, searchpath=searchpath)
ctx = args.pipeline.get_context()
try:
jetstream.utils.dump_yaml(ctx, sys.stdout)
except IOError as e:
if e.errno == errno.EPIPE:
pass
jetstream.utils.dump_yaml(ctx, sys.stdout)
elif args.pipeline:
# Direct pipeline path give, just load and run
run.main(args)
Expand All @@ -78,8 +69,4 @@ def main(args):
# List all pipelines
all_pipelines = jetstream.list_pipelines(*searchpath)
output = '\n'.join(f'{p.name} ({p.version}): {p.path}' for p in all_pipelines)
try:
print(output)
except IOError as e:
if e.errno == errno.EPIPE:
pass
print(output)

0 comments on commit 9460208

Please sign in to comment.