Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Purge occurrences of loop.run_until_complete()
Browse files Browse the repository at this point in the history
  • Loading branch information
locriandev committed Mar 1, 2023
1 parent 5e71055 commit 4f65a79
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
43 changes: 21 additions & 22 deletions doozerlib/cli/release_gen_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from doozerlib import util
from doozerlib.assembly import AssemblyTypes
from doozerlib.cli import cli, pass_runtime
from doozerlib.cli import cli, pass_runtime, click_coroutine
from doozerlib import exectools
from doozerlib.model import Model
from doozerlib import brew
Expand Down Expand Up @@ -58,31 +58,30 @@ def releases_gen_assembly(ctx, name):
@click.option('--output-file', '-o', required=False,
help='Specify a file path to write the generated assembly definition to')
@pass_runtime
@click_coroutine
@click.pass_context
def gen_assembly_from_releases(ctx, runtime: Runtime, nightlies: Tuple[str, ...], standards: Tuple[str, ...],
custom: bool, in_flight: Optional[str], previous_list: Tuple[str, ...],
auto_previous: bool, graph_url: Optional[str], graph_content_stable: Optional[str],
graph_content_candidate: Optional[str], suggestions_url: Optional[str],
output_file: Optional[str]):
async def gen_assembly_from_releases(ctx, runtime: Runtime, nightlies: Tuple[str, ...], standards: Tuple[str, ...],
custom: bool, in_flight: Optional[str], previous_list: Tuple[str, ...],
auto_previous: bool, graph_url: Optional[str], graph_content_stable: Optional[str],
graph_content_candidate: Optional[str], suggestions_url: Optional[str],
output_file: Optional[str]):

runtime.initialize(mode='both', clone_distgits=False, clone_source=False, prevent_cloning=True)

assembly_def = asyncio.get_event_loop().run_until_complete(
GenAssemblyCli(
runtime=runtime,
gen_assembly_name=ctx.obj['ASSEMBLY_NAME'],
nightlies=nightlies,
standards=standards,
custom=custom,
in_flight=in_flight,
previous_list=previous_list,
auto_previous=auto_previous,
graph_url=graph_url,
graph_content_stable=graph_content_stable,
graph_content_candidate=graph_content_candidate,
suggestions_url=suggestions_url,
).run()
)
assembly_def = await GenAssemblyCli(
runtime=runtime,
gen_assembly_name=ctx.obj['ASSEMBLY_NAME'],
nightlies=nightlies,
standards=standards,
custom=custom,
in_flight=in_flight,
previous_list=previous_list,
auto_previous=auto_previous,
graph_url=graph_url,
graph_content_stable=graph_content_stable,
graph_content_candidate=graph_content_candidate,
suggestions_url=suggestions_url,
).run()

print(yaml.dump(assembly_def))
if output_file:
Expand Down
17 changes: 8 additions & 9 deletions doozerlib/cli/release_gen_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from doozerlib.brew import KojiWrapperMetaReturn
from doozerlib.rhcos import RHCOSBuildInspector, RhcosMissingContainerException
from doozerlib.cli import cli, pass_runtime
from doozerlib.cli import cli, pass_runtime, click_coroutine
from doozerlib.image import ImageMetadata, BrewBuildImageInspector, ArchiveImageInspector
from doozerlib.assembly_inspector import AssemblyInspector
from doozerlib.runtime import Runtime
Expand Down Expand Up @@ -57,11 +57,12 @@
help="Also create a release payload for multi-arch/heterogeneous clusters.")
@click.option("--moist-run", default=False, is_flag=True,
help="Mirror and determine tags but do not actually update imagestreams.")
@click_coroutine
@pass_runtime
def release_gen_payload(runtime: Runtime, is_name: str, is_namespace: str, organization: str,
repository: str, release_repository: str, output_dir: str, exclude_arch: Tuple[str, ...],
skip_gc_tagging: bool, emergency_ignore_issues: bool,
apply: bool, apply_multi_arch: bool, moist_run: bool):
async def release_gen_payload(runtime: Runtime, is_name: str, is_namespace: str, organization: str,
repository: str, release_repository: str, output_dir: str, exclude_arch: Tuple[str, ...],
skip_gc_tagging: bool, emergency_ignore_issues: bool,
apply: bool, apply_multi_arch: bool, moist_run: bool):
"""
Computes a set of imagestream tags which can be assembled into an OpenShift release for this
assembly. The tags may not be valid unless --apply or --moist-run triggers mirroring.
Expand Down Expand Up @@ -107,7 +108,7 @@ def release_gen_payload(runtime: Runtime, is_name: str, is_namespace: str, organ
"""

runtime.initialize(mode="both", clone_distgits=False, clone_source=False, prevent_cloning=True)
pipeline = GenPayloadCli(
await GenPayloadCli(
runtime,
is_name or assembly_imagestream_base_name(runtime),
is_namespace or default_imagestream_namespace_base_name(),
Expand All @@ -116,9 +117,7 @@ def release_gen_payload(runtime: Runtime, is_name: str, is_namespace: str, organ
exclude_arch,
skip_gc_tagging, emergency_ignore_issues,
apply, apply_multi_arch, moist_run
)

asyncio.get_event_loop().run_until_complete(pipeline.run())
).run()


def default_imagestream_base_name(version: str) -> str:
Expand Down

0 comments on commit 4f65a79

Please sign in to comment.