Skip to content

Commit ea7b1ce

Browse files
pzhan9meta-codesync[bot]
authored andcommitted
refactoring: make Instance::start infallible
Summary: This method does not need to be fallible. Reviewed By: thedavekwon Differential Revision: D86693429 fbshipit-source-id: 08f6c1c86f3d2b45ad0bd81ab3a9dec589c36288
1 parent 1deef05 commit ea7b1ce

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

hyperactor/src/proc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ impl Proc {
514514
.ledger
515515
.insert(actor_id.clone(), instance.cell.downgrade())?;
516516

517-
instance
517+
Ok(instance
518518
.start(actor, actor_loop_receivers.take().unwrap(), work_rx)
519519
.instrument(span)
520-
.await
520+
.await)
521521
}
522522

523523
/// Create and return an actor instance and its corresponding handle. This allows actors to be
@@ -575,9 +575,9 @@ impl Proc {
575575
let (instance, mut actor_loop_receivers, work_rx) =
576576
Instance::new(self.clone(), actor_id, false, Some(parent.clone()));
577577
let actor = A::new(params).await?;
578-
instance
578+
Ok(instance
579579
.start(actor, actor_loop_receivers.take().unwrap(), work_rx)
580-
.await
580+
.await)
581581
}
582582

583583
/// Call `abort` on the `JoinHandle` associated with the given
@@ -1061,13 +1061,13 @@ impl<A: Actor> Instance<A> {
10611061

10621062
/// Start an A-typed actor onto this instance with the provided params. When spawn returns,
10631063
/// the actor has been linked with its parent, if it has one.
1064-
#[hyperactor::instrument(fields(actor_id=self.cell.actor_id().clone().to_string(), actor_name=self.cell.actor_id().name()))]
1064+
#[hyperactor::instrument_infallible(fields(actor_id=self.cell.actor_id().clone().to_string(), actor_name=self.cell.actor_id().name()))]
10651065
async fn start(
10661066
self,
10671067
actor: A,
10681068
actor_loop_receivers: (PortReceiver<Signal>, PortReceiver<ActorSupervisionEvent>),
10691069
work_rx: mpsc::UnboundedReceiver<WorkCell<A>>,
1070-
) -> Result<ActorHandle<A>, anyhow::Error> {
1070+
) -> ActorHandle<A> {
10711071
let instance_cell = self.cell.clone();
10721072
let actor_id = self.cell.actor_id().clone();
10731073
let actor_handle = ActorHandle::new(self.cell.clone(), self.ports.clone());
@@ -1081,7 +1081,7 @@ impl<A: Actor> Instance<A> {
10811081
.set(actor_task_handle)
10821082
.unwrap_or_else(|_| panic!("{}: task handle store failed", actor_id));
10831083

1084-
Ok(actor_handle)
1084+
actor_handle
10851085
}
10861086

10871087
async fn serve(

0 commit comments

Comments
 (0)