Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request update/240920 #408

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arcee/arcee_receiver/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
aiohttp==3.10.2
sanic==23.12.1
sanic-ext==23.12.0
motor==3.4.0
motor==3.6.0
pymongo==4.9.1
python-etcd==0.4.5
mongodb-migrations==1.2.1
pydantic==2.4.2
Expand Down
3 changes: 2 additions & 1 deletion bulldozer/bulldozer_api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aiohttp==3.10.2
sanic==23.12.1
motor==3.4.0
motor==3.6.0
pymongo==4.9.1
websockets==12.0
kombu==5.3.4
mongodb-migrations==1.2.1
Expand Down
1 change: 1 addition & 0 deletions diworker/diworker/importers/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
AWS_CUR_PREFIX_MAP = {
'identity': (False, []),
'bill': (False, []),
'discount': (False, []),
'line_item': (False, []),
'product': (True, ['product_name', 'purchase_option', 'size_flex']),
'pricing': (True, ['rate_code', 'rate_id', 'purchase_option',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import logging
from optscale_client.rest_api_client.client_v2 import Client as RestClient
from diworker.diworker.migrations.base import BaseMigration
"""
Fixed names for discount fields in AWS expenses
"""
LOG = logging.getLogger(__name__)


class Migration(BaseMigration):
@property
def rest_cl(self):
if self._rest_cl is None:
self._rest_cl = RestClient(
url=self.config_cl.restapi_url(),
secret=self.config_cl.cluster_secret())
return self._rest_cl

@property
def mongo_raw(self):
return self.db.raw_expenses

def get_cloud_accs(self):
cloud_accounts_ids = set()
_, organizations = self.rest_cl.organization_list({
'with_connected_accounts': True, 'is_demo': False})
for org in organizations['organizations']:
_, accounts = self.rest_cl.cloud_account_list(
org['id'], type='aws_cnr')
for cloud_account in accounts['cloud_accounts']:
if cloud_account['auto_import']:
cloud_accounts_ids.add(cloud_account['id'])
return cloud_accounts_ids

def upgrade(self):
cloud_accs = self.get_cloud_accs()
for i, cloud_acc_id in enumerate(cloud_accs):
LOG.info('Starting processing for cloud account %s (%s/%s)' % (
cloud_acc_id, i+1, len(cloud_accs)))
self.db.raw_expenses.update_many(
{'bill/BillingPeriodStartDate': {'$exists': True},
'cloud_account_id': cloud_acc_id},
{'$rename': {
'discount_total_discount': 'discount/TotalDiscount',
'discount_bundled_discount': 'discount/BundledDiscount'}})

def downgrade(self):
pass
14 changes: 0 additions & 14 deletions ngui/ui/src/components/TagKey/TagKey.test.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions ngui/ui/src/components/TagKey/TagKey.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions ngui/ui/src/components/TagKey/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import { useMemo } from "react";
import BarChartOutlinedIcon from "@mui/icons-material/BarChartOutlined";
import { FormattedMessage } from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";
import FormattedMoney from "components/FormattedMoney";
import Table from "components/Table";
import TableCellActions from "components/TableCellActions";
import TableLoader from "components/TableLoader";
import TagKey from "components/TagKey";
import TextWithDataTestId from "components/TextWithDataTestId";
import TextWithDate from "components/TextWithDate";
import { FORMATTED_MONEY_TYPES } from "utils/constants";

const getTotalBreakdownTableData = (counts) =>
Object.entries(counts).map(([id, { name = "", ...details }]) => ({
id: id ?? name,
name,
...details
}));

const TagsBreakdownTable = ({ data, appliedRange, isLoading, selectedTag, onShowOnChartClick }) => {
const tableData = useMemo(() => getTotalBreakdownTableData(data), [data]);
const tableData = useMemo(() => data, [data]);

const intl = useIntl();

const columns = useMemo(
() => [
Expand All @@ -28,8 +22,12 @@ const TagsBreakdownTable = ({ data, appliedRange, isLoading, selectedTag, onShow
<FormattedMessage id="tagKey" />
</TextWithDataTestId>
),
accessorKey: "tag",
cell: ({ cell }) => <TagKey tagKey={cell.getValue()} />
id: "tagKey",
accessorFn: ({ tag }) =>
tag ??
intl.formatMessage({
id: "(untagged)"
})
},
{
header: (
Expand Down Expand Up @@ -81,7 +79,7 @@ const TagsBreakdownTable = ({ data, appliedRange, isLoading, selectedTag, onShow
)
}
],
[appliedRange.startSecondsTimestamp, appliedRange.endSecondsTimestamp, onShowOnChartClick, selectedTag]
[appliedRange.startSecondsTimestamp, appliedRange.endSecondsTimestamp, intl, selectedTag, onShowOnChartClick]
);

return isLoading ? (
Expand Down
Binary file modified rest_api/live_demo.tar.xz
Binary file not shown.
4 changes: 2 additions & 2 deletions rest_api/rest_api_server/controllers/live_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
TOP_NO_DUPLICATE_RESOURCES = 10
DUPLICATION_FORMAT = '-x{ending}'
WITH_SUBPOOLS_SIGN = '+'
MIN_RUN_DURATION = 7 * 60 * 60
MAX_RUN_DURATION = 24 * 60 * 60
MIN_RUN_DURATION = 14 * 60 * 60
MAX_RUN_DURATION = 48 * 60 * 60
RECOMMENDATION_MULTIPLIED_FIELDS = ['saving', 'annually_monthly_saving',
'monthly_saving']
PREPARED_DEMO_LIFETIME_DAYS = 3
Expand Down
Loading