https://bentoml.com logo
Join Slack
Powered by
# bentoml-pagarba_io
  • m

    Matheus

    10/10/2022, 1:26 PM
    Hello guys. I am trying to interact with command line through
    subprocess
    to select which
    bentoctl operator
    to use. Unfortunately I could not find one way to interact with this menu when I call
    bentoctl init
    . Do you have any experience on how can I do this? If I only have one operator installed this menu never appears. But I want to do multiple calls in parallel, so I first install all the operators, and after I call
    bentoctl init
    . If I uninstall one operator in any moment, I will break a parallel process. This is why I am forced to understand how to interact with this menu.
  • m

    Matheus

    10/10/2022, 1:28 PM
    The way I am doing this is using
    subprocess.Popen
    that works completely fine if I should not interact with this menu.
  • j

    jjmachan

    10/10/2022, 2:22 PM
    I'm not sure if I understand what u are trying to do but if you want to use 2 different operators you can use 2 different deployment config files right?
  • j

    jjmachan

    10/10/2022, 2:23 PM
    You will have to create different folders for each of the generated files
  • b

    Bo

    10/10/2022, 6:23 PM
    @Matheus You could also generate the yaml file without using
    bentoctl init
    . It is probably an easier way to automate this process
  • m

    Matheus

    10/10/2022, 7:21 PM
    @Bo I just solved the problem in the way you suggested. I created the
    deployment_config.yaml
    using
    pyYaml
    and after used
    bentoctl generate
    to create
    bentoctl.tfvars
    and
    <http://main.tf|main.tf>
    . It worked!
  • m

    Matheus

    10/10/2022, 7:23 PM
    @jjmachan that is exactly what I am doing. I am creating one folder that register every process creating sub-folders with id of each run. In each sub-folder I have the terraform files. You can see it below
  • m

    Matheus

    10/10/2022, 7:27 PM
    And now it comes my second issue.
    bentoctl build
    updates bentoctl.tfvar with those 3 informations: • image_tag = <image_tag> • image_repository = <image_repository> • image_version = <image_version> Unfortunately
    bentoctl build
    does not have an option to specify the output location of the
    bentoctl.tfvars
    file, so it is being saved in my root path (what completely breaks the idea of parallelism that I should have inn my project). In other words, I am only able to specify the input --deployment-config-file but I am not able to specify where I want that the
    bentoctl.tfvars
    are generated.
  • m

    Matheus

    10/10/2022, 9:18 PM
    For the moment I am only appending those lines to the
    bentoctl.tfvars
    file as a turnaround. But I believe that enable users specify the output path is something useful for
    bentoctl
  • m

    Matheus

    11/01/2022, 8:37 PM
    Guys do you have any solution for periodic calls of a function using
    bentoml
    ? I am trying to use the lib
    AsyncIOScheduler
    but it does not work if I serve my app with
    bentoml
    . It works if I serve my app with
    fastapi
    though
  • m

    Matheus

    11/01/2022, 8:54 PM
    I basically applied with this guy said https://github.com/tiangolo/fastapi/issues/520#issuecomment-716969948
  • m

    Matheus

    11/01/2022, 8:54 PM
    But it not works when I serve my app with
    bentoml
  • s

    Sean

    11/02/2022, 7:35 AM
    When you say periodic calls to a function, do you mean from an external source?
  • m

    Matheus

    11/02/2022, 1:33 PM
    No, I mean that the bentoml app calls a route periodically
  • m

    Matheus

    11/02/2022, 1:34 PM
    I opened this bug on github. Can try to replicate it and verify what I mean?
  • m

    Matheus

    11/02/2022, 1:34 PM
    https://github.com/bentoml/BentoML/issues/3173
  • s

    Sean

    11/03/2022, 11:55 PM
    I think you can use FastAPI to achieve scheduled task. In FastAPI, you can add
    startup
    and
    shutdown
    event to an app. You can schedule the task against a
    BackgroundScheduler
    in the startup and shutdown the scheduler in the
    shutdown
    event. https://fastapi.tiangolo.com/advanced/events/
  • s

    Sean

    11/03/2022, 11:56 PM
    Though running scheduled task in a service is not well supported use case.
  • m

    Matheus

    11/07/2022, 8:19 PM
    Hello @Sean
  • m

    Matheus

    11/07/2022, 8:20 PM
    The code i shared is perfecly running with fastapi, The problem is that it is not running with bentoml, and that is the problem to me because I have a bento app that mounts a fastapi app
  • m

    Matheus

    11/14/2022, 2:10 AM
    Hello guys
  • m

    Matheus

    11/14/2022, 2:11 AM
    Is there a way I can specify the path of a file in the deployed machine differently than the calling machine in the
    bentofile.yaml
    ?
  • m

    Matheus

    11/14/2022, 2:12 AM
    Copy code
    service: "service:svc"
    include:
    - src.job.2222.file.py:src.job.file.py
  • m

    Matheus

    11/14/2022, 2:12 AM
    Something like this
  • m

    Matheus

    11/14/2022, 2:12 AM
    The name in the left should be the file location in the calling machine and the second should be the path in the deployed machine
  • s

    Sean

    11/16/2022, 6:06 AM
    Hi @Matheus, this is not possible. The problem is more fundamental with Python. If a module needs to import
    src.job.2222.file.py
    , how would you write the
    import
    statement so that the module can be imported correctly in both the calling and deployed machine?
  • m

    Matheus

    11/16/2022, 12:56 PM
    In details my problem is that I am deploying multiple models in pararell with
    bentoctl
    in GCP. For this each model has a folder with a job_id in my source machine, where terraform files are created. But in the
    deployment
    machine there is not a way to know the
    job_id
    number. My solutions was to read the content of the FIRST
    job_id
    folder even thought we dont know its number. But the problem it that it can not be done in the
    __init__
    method because it is called in the source machine, and the deployment does not work. I need to read the content of this folder only in my
    predict
    route, but if have multiple routes i need to repeat the same code in all of them. I also realised that even with I could change the path I would not be able to read it in the
    init
    method of my router 😅, so I will keep my solution for now.
  • s

    Slackbot

    01/20/2023, 4:53 PM
    This message was deleted.
    j
    • 2
    • 1
  • m

    Matheus

    01/20/2023, 4:54 PM
    deployment_config.yaml have the configurations below
  • m

    Matheus

    01/20/2023, 4:54 PM
    Copy code
    api_version: v1
    name: aws-linux-no-gpu
    operator:
      name: aws-ec2
    template: terraform
    spec:
      region: us-east-1
      instance_type: t2.xlarge
      ami_id: ami-033af8584d6c13c36
      enable_gpus: True