Skip to content

Commit

Permalink
Merge branch 'master' into master+incremental-lineage-for-redshift
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Oct 23, 2023
2 parents 3510863 + 8fb95e8 commit 07c188a
Show file tree
Hide file tree
Showing 76 changed files with 1,490 additions and 469 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.linkedin.datahub.graphql.generated.IngestionConfig;
import com.linkedin.datahub.graphql.generated.IngestionSchedule;
import com.linkedin.datahub.graphql.generated.IngestionSource;
import com.linkedin.datahub.graphql.generated.StringMapEntry;
import com.linkedin.datahub.graphql.generated.StructuredReport;
import com.linkedin.datahub.graphql.types.common.mappers.StringMapMapper;
import com.linkedin.entity.EntityResponse;
Expand All @@ -21,6 +22,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;


Expand Down Expand Up @@ -143,6 +145,14 @@ public static IngestionConfig mapIngestionSourceConfig(final DataHubIngestionSou
result.setVersion(config.getVersion());
result.setExecutorId(config.getExecutorId());
result.setDebugMode(config.isDebugMode());
if (config.getExtraArgs() != null) {
List<StringMapEntry> extraArgs = config.getExtraArgs()
.keySet()
.stream()
.map(key -> new StringMapEntry(key, config.getExtraArgs().get(key)))
.collect(Collectors.toList());
result.setExtraArgs(extraArgs);
}
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public CompletableFuture<String> get(final DataFetchingEnvironment environment)
if (ingestionSourceInfo.getConfig().hasDebugMode()) {
debugMode = ingestionSourceInfo.getConfig().isDebugMode() ? "true" : "false";
}
if (ingestionSourceInfo.getConfig().hasExtraArgs()) {
arguments.putAll(ingestionSourceInfo.getConfig().getExtraArgs());
}
arguments.put(DEBUG_MODE_ARG_NAME, debugMode);
execInput.setArgs(new StringMap(arguments));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.linkedin.datahub.graphql.resolvers.ingest.source;

import com.linkedin.common.urn.Urn;
import com.linkedin.data.template.StringMap;
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLErrorCode;
import com.linkedin.datahub.graphql.exception.DataHubGraphQLException;
import com.linkedin.datahub.graphql.generated.StringMapEntryInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceConfigInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceInput;
import com.linkedin.datahub.graphql.generated.UpdateIngestionSourceScheduleInput;
Expand All @@ -17,6 +19,8 @@
import com.linkedin.mxe.MetadataChangeProposal;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;

import java.net.URISyntaxException;
Expand Down Expand Up @@ -108,6 +112,12 @@ private DataHubIngestionSourceConfig mapConfig(final UpdateIngestionSourceConfig
if (input.getDebugMode() != null) {
result.setDebugMode(input.getDebugMode());
}
if (input.getExtraArgs() != null) {
Map<String, String> extraArgs = input.getExtraArgs()
.stream()
.collect(Collectors.toMap(StringMapEntryInput::getKey, StringMapEntryInput::getValue));
result.setExtraArgs(new StringMap(extraArgs));
}
return result;
}

Expand Down
10 changes: 10 additions & 0 deletions datahub-graphql-core/src/main/resources/ingestion.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ type IngestionConfig {
Advanced: Whether or not to run ingestion in debug mode
"""
debugMode: Boolean

"""
Advanced: Extra arguments for the ingestion run.
"""
extraArgs: [StringMapEntry!]
}

"""
Expand Down Expand Up @@ -483,6 +488,11 @@ input UpdateIngestionSourceConfigInput {
Whether or not to run ingestion in debug mode
"""
debugMode: Boolean

"""
Extra arguments for the ingestion run.
"""
extraArgs: [StringMapEntryInput!]
}

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class UpsertIngestionSourceResolverTest {
"Test source",
"mysql", "Test source description",
new UpdateIngestionSourceScheduleInput("* * * * *", "UTC"),
new UpdateIngestionSourceConfigInput("my test recipe", "0.8.18", "executor id", false)
new UpdateIngestionSourceConfigInput("my test recipe", "0.8.18", "executor id", false, null)
);

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function CreateGlossaryEntityModal(props: Props) {
<Button onClick={onClose} type="text">
Cancel
</Button>
<Button onClick={createGlossaryEntity} disabled={createButtonDisabled}>
<Button
onClick={createGlossaryEntity}
disabled={createButtonDisabled}
data-testid="glossary-entity-modal-create-button"
>
Create
</Button>
</>
Expand All @@ -130,6 +134,7 @@ function CreateGlossaryEntityModal(props: Props) {
>
<Form.Item label={<Typography.Text strong>Name</Typography.Text>}>
<StyledItem
data-testid="create-glossary-entity-modal-name"
name="name"
rules={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ function EntityDropdown(props: Props) {
)}
{!isDomainMoveHidden && menuItems.has(EntityMenuItems.MOVE) && (
<StyledMenuItem
data-testid="entity-menu-move-button"
key="4"
disabled={isMoveDisabled(entityType, entityData, me.platformPrivileges)}
onClick={() => setIsMoveModalVisible(true)}
>
<MenuItem data-testid="entity-menu-move-button">
<MenuItem>
<FolderOpenOutlined /> &nbsp;Move
</MenuItem>
</StyledMenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function MoveGlossaryEntityModal(props: Props) {

return (
<Modal
data-testid="move-glossary-entity-modal"
title="Move"
visible
onCancel={onClose}
Expand All @@ -72,7 +73,9 @@ function MoveGlossaryEntityModal(props: Props) {
<Button onClick={onClose} type="text">
Cancel
</Button>
<Button onClick={moveGlossaryEntity}>Move</Button>
<Button onClick={moveGlossaryEntity} data-testid="glossary-entity-modal-move-button">
Move
</Button>
</>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export default function UpdateDescriptionModal({ title, description, original, o
footer={
<>
<Button onClick={onClose}>Cancel</Button>
<Button onClick={() => onSubmit(updatedDesc)} disabled={updatedDesc === description}>
<Button
onClick={() => onSubmit(updatedDesc)}
disabled={updatedDesc === description}
data-testid="description-modal-update-button"
>
Update
</Button>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const AddLinkModal = ({ buttonProps, refetch }: AddLinkProps) => {

return (
<>
<Button icon={<PlusOutlined />} onClick={showModal} {...buttonProps}>
<Button data-testid="add-link-button" icon={<PlusOutlined />} onClick={showModal} {...buttonProps}>
Add Link
</Button>
<Modal
Expand All @@ -69,13 +69,14 @@ export const AddLinkModal = ({ buttonProps, refetch }: AddLinkProps) => {
<Button type="text" onClick={handleClose}>
Cancel
</Button>,
<Button form="addLinkForm" key="submit" htmlType="submit">
<Button data-testid="add-link-modal-add-button" form="addLinkForm" key="submit" htmlType="submit">
Add
</Button>,
]}
>
<Form form={form} name="addLinkForm" onFinish={handleAdd} layout="vertical">
<Form.Item
data-testid="add-link-modal-url"
name="url"
label="URL"
rules={[
Expand All @@ -93,6 +94,7 @@ export const AddLinkModal = ({ buttonProps, refetch }: AddLinkProps) => {
<Input placeholder="https://" autoFocus />
</Form.Item>
<Form.Item
data-testid="add-link-modal-label"
name="label"
label="Label"
rules={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export const SidebarOwnerSection = ({ properties, readOnly }: Props) => {
</Typography.Paragraph>
)}
{!readOnly && (
<Button type={ownersEmpty ? 'default' : 'text'} onClick={() => setShowAddModal(true)}>
<Button
type={ownersEmpty ? 'default' : 'text'}
onClick={() => setShowAddModal(true)}
data-testid="add-owners-button"
>
<PlusOutlined /> Add Owners
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const DocumentationTab = ({ properties }: { properties?: Props }) => {
<TabToolbar>
<div>
<Button
data-testid="edit-documentation-button"
type="text"
onClick={() => routeToTab({ tabName: 'Documentation', tabParams: { editing: true } })}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const DescriptionEditorToolbar = ({ disableSave, onClose, onSave }: Descr
<Button type="text" onClick={onClose}>
Back
</Button>
<Button onClick={onSave} disabled={disableSave}>
<Button data-testid="description-editor-save-button" onClick={onSave} disabled={disableSave}>
<CheckOutlined /> Save
</Button>
</TabToolbar>
Expand Down
4 changes: 3 additions & 1 deletion datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ function BusinessGlossaryPage() {
{(termsError || nodesError) && (
<Message type="error" content="Failed to load glossary! An unexpected error occurred." />
)}
<MainContentWrapper>
<MainContentWrapper data-testid="glossary-entities-list">
<HeaderWrapper>
<Typography.Title level={3}>Business Glossary</Typography.Title>
<div>
<Button
data-testid="add-term-button"
id={BUSINESS_GLOSSARY_CREATE_TERM_ID}
disabled={!canManageGlossaries}
type="text"
Expand All @@ -105,6 +106,7 @@ function BusinessGlossaryPage() {
<PlusOutlined /> Add Term
</Button>
<Button
data-testid="add-term-group-button"
id={BUSINESS_GLOSSARY_CREATE_TERM_GROUP_ID}
disabled={!canManageGlossaries}
type="text"
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/glossary/GlossarySidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function GlossarySidebar() {

return (
<>
<SidebarWrapper width={browserWidth}>
<SidebarWrapper width={browserWidth} data-testid="glossary-browser-sidebar">
<GlossarySearch />
<GlossaryBrowser openToEntity />
</SidebarWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const SecretBuilderModal = ({ initialState, visible, onSubmit, onCancel }
Cancel
</Button>
<Button
data-testid="secret-modal-create-button"
id="createSecretButton"
onClick={() =>
onSubmit?.(
Expand Down Expand Up @@ -71,6 +72,7 @@ export const SecretBuilderModal = ({ initialState, visible, onSubmit, onCancel }
Give your secret a name. This is what you&apos;ll use to reference the secret from your recipes.
</Typography.Paragraph>
<Form.Item
data-testid="secret-modal-name-input"
name={NAME_FIELD_NAME}
rules={[
{
Expand All @@ -91,6 +93,7 @@ export const SecretBuilderModal = ({ initialState, visible, onSubmit, onCancel }
The value of your secret, which will be encrypted and stored securely within DataHub.
</Typography.Paragraph>
<Form.Item
data-testid="secret-modal-value-input"
name={VALUE_FIELD_NAME}
rules={[
{
Expand All @@ -110,6 +113,7 @@ export const SecretBuilderModal = ({ initialState, visible, onSubmit, onCancel }
An optional description to help keep track of your secret.
</Typography.Paragraph>
<Form.Item
data-testid="secret-modal-description-input"
name={DESCRIPTION_FIELD_NAME}
rules={[{ whitespace: true }, { min: 1, max: 500 }]}
hasFeedback
Expand Down
6 changes: 5 additions & 1 deletion datahub-web-react/src/app/ingest/secret/SecretsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ export const SecretsList = () => {
<div>
<TabToolbar>
<div>
<Button type="text" onClick={() => setIsCreatingSecret(true)}>
<Button
data-testid="create-secret-button"
type="text"
onClick={() => setIsCreatingSecret(true)}
>
<PlusOutlined /> Create new secret
</Button>
</div>
Expand Down
15 changes: 13 additions & 2 deletions datahub-web-react/src/app/ingest/source/IngestionSourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Message } from '../../shared/Message';
import TabToolbar from '../../entity/shared/components/styled/TabToolbar';
import { IngestionSourceBuilderModal } from './builder/IngestionSourceBuilderModal';
import { addToListIngestionSourcesCache, CLI_EXECUTOR_ID, removeFromListIngestionSourcesCache } from './utils';
import { DEFAULT_EXECUTOR_ID, SourceBuilderState } from './builder/types';
import { DEFAULT_EXECUTOR_ID, SourceBuilderState, StringMapEntryInput } from './builder/types';
import { IngestionSource, UpdateIngestionSourceInput } from '../../../types.generated';
import { SearchBar } from '../../search/SearchBar';
import { useEntityRegistry } from '../../useEntityRegistry';
Expand Down Expand Up @@ -173,6 +173,11 @@ export const IngestionSourceList = () => {
setFocusSourceUrn(undefined);
};

const formatExtraArgs = (extraArgs): StringMapEntryInput[] => {
if (extraArgs === null || extraArgs === undefined) return [];
return extraArgs.map((entry) => ({ key: entry.key, value: entry.value }));
};

const createOrUpdateIngestionSource = (
input: UpdateIngestionSourceInput,
resetState: () => void,
Expand Down Expand Up @@ -294,6 +299,7 @@ export const IngestionSourceList = () => {
(recipeBuilderState.config?.executorId as string)) ||
DEFAULT_EXECUTOR_ID,
debugMode: recipeBuilderState.config?.debugMode || false,
extraArgs: formatExtraArgs(recipeBuilderState.config?.extraArgs || []),
},
schedule: recipeBuilderState.schedule && {
interval: recipeBuilderState.schedule?.interval as string,
Expand Down Expand Up @@ -358,7 +364,12 @@ export const IngestionSourceList = () => {
<SourceContainer>
<TabToolbar>
<div>
<Button id={INGESTION_CREATE_SOURCE_ID} type="text" onClick={() => setIsBuildingSource(true)}>
<Button
id={INGESTION_CREATE_SOURCE_ID}
type="text"
onClick={() => setIsBuildingSource(true)}
data-testid="create-ingestion-source-button"
>
<PlusOutlined /> Create new source
</Button>
<Button id={INGESTION_REFRESH_SOURCES_ID} type="text" onClick={onRefresh}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ export function LastStatusColumn({ status, record, setFocusExecutionUrn }: LastS
return (
<StatusContainer>
{Icon && <Icon style={{ color, fontSize: 14 }} />}
<StatusButton type="link" onClick={() => setFocusExecutionUrn(record.lastExecUrn)}>
<StatusButton
data-testid="ingestion-source-table-status"
type="link"
onClick={() => setFocusExecutionUrn(record.lastExecUrn)}
>
<Typography.Text strong style={{ color, marginLeft: 8 }}>
{text || 'Pending...'}
</Typography.Text>
Expand Down Expand Up @@ -159,7 +163,11 @@ export function ActionsColumn({
</Tooltip>
)}
{!record.cliIngestion && (
<Button style={{ marginRight: 16 }} onClick={() => onEdit(record.urn)}>
<Button
data-testid="ingestion-source-table-edit-button"
style={{ marginRight: 16 }}
onClick={() => onEdit(record.urn)}
>
EDIT
</Button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ export const CreateScheduleStep = ({ state, updateState, goTo, prev }: StepProps
<ControlsContainer>
<Button onClick={prev}>Previous</Button>
<div>
<Button disabled={!interval || interval.length === 0 || cronAsText.error} onClick={onClickNext}>
<Button
data-testid="ingestion-schedule-next-button"
disabled={!interval || interval.length === 0 || cronAsText.error}
onClick={onClickNext}
>
Next
</Button>
</div>
Expand Down
Loading

0 comments on commit 07c188a

Please sign in to comment.