2020-12-28

Updating data used by AWS Elastic Beanstalk deployed Webapp

I've created a dashboard and deployed it on AWS Elastic Beanstalk. The data fed into my dashboard is supplied by a CSV file in my S3 bucket, set to update every 12 hours with AWS EventBridge. For some reason, my deployed dashboard is not updating. It's still using the same old data from my previous deployment even though the CSV file has been updating correctly.

More specifically:

  • I'm trying to create a Dashboard with Plotly Dash to visualize some trends starting from 2020-01-01.
  • I had a Lambda function that scrapes the data and saves them as a CSV file in an S3 bucket. This CSV file gets overwritten every 12 hours to capture the latest available trends.
  • I used boto3 to fetch the CSV file directly from my S3 bucket and use its data to construct my dashboard.
  • The app was then deployed with Elastic Beanstalk.
  • Everything was written in a Cloud9 environment, except for setting up the EventBridge trigger.

Say I deployed the app on 2020-12-10. The CSV file would contain all data up till 2020-12-10, and my dashboard would show trends between 2020-01-01 and 2020-12-10.

However, if I check the dashboard anytime after 2020-12-10 (or when the CSV file is updated with data post 2020-12-10), it still shows the same trends (between 2020-01-01 and 2020-12-10), though the CSV file in my S3 bucket is up to date.

The dashboard would update only if I redeploy the app on Elastic Beanstalk. Not sure why this is the case since my app is pulling the data directly from the updated CSV file.

Is my architecture incorrect here? Or do I need to tweak some settings in AWS?

Thanks in advance!


Update:

I'm using the following codes to load my data into trends_data dataframe.

# define bucket name
bucket = "mobilitytrends"
# define s3 client
s3 = boto3.client('s3')
# define file names
historical_file_name = 'historical_trends.csv'
# load historical data from s3
data_obj = s3.get_object(Bucket= bucket, Key= historical_file_name)
trend_data = pd.read_csv(data_obj['Body'],low_memory = False)

I then have some functions that clean this dataframe. I have a scatterplot that's rendered using the code snippet below:

fig.add_scatter(x = filtered_trend.index,
                y = filtered_trend[transportation],
                line = dict(color = line_color[idx]),
                name = transportation)

filtered_trend is a subset of trends_data, which gets selected based on some callback functions that I set up. But I don't think that's where the problem lies since everything worked fine locally.



from Recent Questions - Stack Overflow https://ift.tt/3aI7zHH
https://ift.tt/eA8V8J

No comments:

Post a Comment