Giter Club home page Giter Club logo

Comments (12)

FutureSharks avatar FutureSharks commented on May 27, 2024 1

Thanks!

I'll definitely fix it. Your use case sounds interesting. But it will take me a few days as I have little free time right now.

In the mean time, as a workaround for you, you can set an env var AWS_DEFAULT_REGION=eu-west-1 to stop the error.

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

I don't know what that is but you can simply use the first example:
https://github.com/FutureSharks/invokust#examples
This doesn't use Lambda.

from invokust.

alexellis avatar alexellis commented on May 27, 2024

It's Serverless FaaS but open-source (rather than proprietary/cloud-hosted) OpenFaaS/faas. This is what I managed to put together - https://github.com/alexellis/locust-openfaas

What do you think?

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

I see, interesting! Looks OK but using subprocess is a bit hacky for something that is supposed to be serverless?

If I was you, in locust/index.py, I would copy the code from my example and then return/print the stats.

from invokust.

alexellis avatar alexellis commented on May 27, 2024

Creating a subprocess via the handler doesn't make it any more or less serverless. I couldn't find out how to launch locust without using their binary / helper, but if you have a way I'd be interested in changing over to it.

I think I tried your code last night but it had a boto3 or Lambda session reference somewhere that stopped it from working. Have you tried locust/index.py in a regular Docker container for instance?

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

Creating a subprocess via the handler doesn't make it any more or less serverless.

OK fair enough 👍

I couldn't find out how to launch locust without using their binary / helper

That is exactly what this project does, as per the first example.

I think I tried your code last night but it had a boto3 or Lambda session reference somewhere that stopped it from working.

If you be specific, I'd be happy to help!

Have you tried locust/index.py in a regular Docker container for instance?

Nope.

from invokust.

alexellis avatar alexellis commented on May 27, 2024

Code:

import invokust

from locust import HttpLocust, TaskSet, task

class Task(TaskSet):
    @task()
    def get_home_page(self):
        '''
        Gets /
        '''
        self.client.get("/")

class WebsiteUser(HttpLocust):
    task_set = Task

settings = invokust.create_settings(
    classes=[WebsiteUser],
    host='http://www.openfaas.com',
    num_requests=10,
    num_clients=1,
    hatch_rate=1
    )

loadtest = invokust.LocustLoadTest(settings)
loadtest.run()
loadtest.stats()

Error:

Traceback (most recent call last):
  File "index.py", line 1, in <module>
    import invokust
  File "/usr/local/lib/python3.6/site-packages/invokust/__init__.py", line 5, in <module>
    from .aws_lambda import get_lambda_runtime_info
  File "/usr/local/lib/python3.6/site-packages/invokust/aws_lambda/__init__.py", line 4, in <module>
    from .lambda_load_test import LambdaLoadTest
  File "/usr/local/lib/python3.6/site-packages/invokust/aws_lambda/lambda_load_test.py", line 17, in <module>
    client = session.client('lambda', config=config)
  File "/usr/local/lib/python3.6/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 861, in create_client
    client_config=config, api_version=api_version)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 73, in create_client
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 285, in _get_client_args
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/usr/local/lib/python3.6/site-packages/botocore/args.py", line 45, in get_client_args
    endpoint_url, is_secure, scoped_config)
  File "/usr/local/lib/python3.6/site-packages/botocore/args.py", line 111, in compute_client_args
    service_name, region_name, endpoint_url, is_secure)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 358, in resolve
    service_name, region_name)
  File "/usr/local/lib/python3.6/site-packages/botocore/regions.py", line 122, in construct_endpoint
    partition, service_name, region_name)
  File "/usr/local/lib/python3.6/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

from invokust.

alexellis avatar alexellis commented on May 27, 2024

Btw I also saw you have an interest in RPi - OpenFaaS also runs natively on Raspberry Pi and 64-bit ARM.

Let me know if you can push a fix up for testing that doesn't try to load boto and all that other Lambda stuff.

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

Hi @alexellis could you test this PR and see if it solves the problem for you?
#14

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

Any update on this issue?

from invokust.

alexellis avatar alexellis commented on May 27, 2024

This is as far as I got - https://github.com/alexellis/locust-openfaas - it is working with the regular locust framework rather than the invokust wrapper. It would still be nice to get invokust working w/o a hard dependency on Lambda.

I'm really busy trying to get a new release out.. Would you be willing to spend a bit of time on it?

from invokust.

FutureSharks avatar FutureSharks commented on May 27, 2024

Would you be willing to spend a bit of time on it?

Spend more time on what? I fixed your issue in PR 14: #14
I'm waiting for you to test it.

from invokust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.