Not seizing a resource in sub-trajectory of reneg_in

36 views
Skip to first unread message

David Rios

unread,
Apr 8, 2020, 3:46:30 PM4/8/20
to simmer-devel
Hi all, 

Having an issue where seize does not work in a sub-trajectory after reneg in 

Reproducible example: 

simple.simmer <-simmer()

ia  <- trajectory()  %>%
  seize("resource", 1) %>%
  timeout(2) %>%
  release("resource", 1)

out1<-trajectory() %>% 
  log_("i have reneged") %>%
  set_prioritization(values =  c(1,1,0), mod = "+") %>% 
  log_("i have updated prioritization") %>%
  seize("resource",1,
        reject = trajectory(verbose = T) %>% 
          log_("i have been kicked out for some reqason")) %>%
  log_("seized resource") %>%
  timeout(1) %>%
  release("resource", 1)

ib <- trajectory()  %>%
  log_("here i am") %>%
  renege_in( 
    t = function(){  2 }, 
    out = out1
  ) %>% 
  log_("waiting for resource") %>% 
  seize("resource",1) %>%
  renege_abort() %>% 
  log_("seized resource") %>% 
  timeout(0.5) %>%
  release("resource", 1) %>% 
log_("left ")

simple.simmer %>% 
  add_resource("resource", capacity = 1,mon = T) %>% 
  add_generator("r1", ia, distribution = at(1:10), mon=2,priority = 2) %>%
  add_generator("r2", ib, distribution = at(5), mon=2, priority = 1)


simple.simmer %>% 
  run(until = 20)

get_queue_count( simple.simmer,"resource")

Output: 

5: r20: here i am
5: r20: waiting for resource
7: r20: i have reneged
7: r20: i have updated prioritization


Expect that seize would be able to seize the resource in the sub trajectory. 

Thanks in advance 

Iñaki Ucar

unread,
Apr 9, 2020, 6:14:45 PM4/9/20
to simmer-devel
Yeap, this is a bug. Good catch! Could you please file an issue on
GitHub? Thanks!

Iñaki
> --
> You received this message because you are subscribed to the Google Groups "simmer-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/f17529cb-bf1d-40af-b564-50b8b6ac7330%40googlegroups.com.



--
Iñaki Úcar

Iñaki Ucar

unread,
Apr 9, 2020, 6:31:37 PM4/9/20
to simmer-devel
As a workaround, you can rollback up to the ib trajectory after
setting the new priority, instead of seizing the resource in the
handler.

Iñaki
--
Iñaki Úcar

Iñaki Ucar

unread,
Apr 10, 2020, 6:24:39 AM4/10/20
to simmer-devel
Tracked here: https://github.com/r-simmer/simmer/issues/227
--
Iñaki Úcar

Iñaki Ucar

unread,
Apr 10, 2020, 8:38:10 AM4/10/20
to simmer-devel
Fixed in master. I'll roll out a patch release today, because this is
an important fix. Thanks again for the report.

Iñaki
--
Iñaki Úcar

David Rios

unread,
Apr 11, 2020, 6:37:08 PM4/11/20
to simmer-devel
Thanks a lot this is great! Appreciate the quick fix. 
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to simmer...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages