-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve hot-reloading, display Python errors in Dagit UI (#242)
* Capture, expose most recent python error to GraphQL * Simplify implementation of dynamic loading, handle case where initial load fails The problem with the current implementation of DynamicObject is that the tuple contains both the `module` reference and also the evaluated result. If you can’t evaluate the function, you can’t obtain a DynamicObject, which means you have no module handle to use to call `importlib.reload`. To fix this I’ve split the loading into a two phase process—we create a `DynamicObject` with just the module and function name, and then evaluate the module separately. This allows 1) the evaluation to be done in the try catch and 2) means the initial load can fail and still have a DynamicObject with a module reference. I also made `eval` idempotent so it can also replace `reload_dynamic_object`. * Display errors in the React UI * Fix the tests * Fix tests, allow RepositoryContainer(repository=obj) for inline repos * Put the new error field in the mock graphql response to fix JS test * DynamicLoader eval => load * Very slightly move code coercing pipeline to repo * Expose pipelinesOrErrors, pipelineOrError at top level of graphql schema * Client-side updates to use pipelinesOrErrors * Use the reloader module to build a dependency graph, reload everything in order * Fix the web app mock query data * Do a bit of linting * Handle non-pipeline, non-repository case with fall through exception * Included reloader in the wrong python setup.py * On Python 2, disable module reloading by stubbing `reloader` * Only install reloader on python3, setup script isn’t even compatible with 2.x * Reload dagster itself (though it is not in the watched path) * check.inst_param => check.inst * Just throw rather than nicely returning if no repository is present * Revert "Very slightly move code coercing pipeline to repo" This reverts commit 24548f6. # Conflicts: # python_modules/dagster/dagster/cli/dynamic_loader.py * Explicitly check for two supported types * Fix tests * Add comment
- Loading branch information
Showing
13 changed files
with
393 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as React from "react"; | ||
import styled from "styled-components"; | ||
import { Button } from "@blueprintjs/core"; | ||
|
||
interface IPythonErrorInfoProps { | ||
error: { | ||
message: string; | ||
stack: string[]; | ||
}; | ||
} | ||
|
||
export default class PythonErrorInfo extends React.Component< | ||
IPythonErrorInfoProps, | ||
{} | ||
> { | ||
render() { | ||
const { message, stack } = this.props.error; | ||
|
||
return ( | ||
<ErrorWrapper> | ||
<ErrorHeader>{message}</ErrorHeader> | ||
<Trace>{stack.join("")}</Trace> | ||
<Button icon="refresh" onClick={() => window.location.reload()}> | ||
Reload | ||
</Button> | ||
</ErrorWrapper> | ||
); | ||
} | ||
} | ||
|
||
const ErrorHeader = styled.h3` | ||
color: #b05c47; | ||
font-weight: 400; | ||
margin: 0.5em 0 0.25em; | ||
`; | ||
|
||
const BoldMessage = styled.div` | ||
font-weight: 600; | ||
font-family: Consolas, Menlo, monospace; | ||
font-size: 0.95em; | ||
margin-bottom: 0.7em; | ||
`; | ||
|
||
const Trace = styled.div` | ||
color: rgb(41, 50, 56); | ||
font-family: Consolas, Menlo, monospace; | ||
font-size: 0.85em; | ||
white-space: pre; | ||
overflow-x: scroll; | ||
padding-bottom: 1em; | ||
`; | ||
|
||
const ErrorWrapper = styled.div` | ||
position: absolute; | ||
left: 50%; | ||
top: 100px; | ||
transform: translate(-50%, 0); | ||
margin-bottom: 100px; | ||
background-color: rgba(206, 17, 38, 0.05); | ||
border: 1px solid #d17257; | ||
border-radius: 3px; | ||
max-width: 90vw; | ||
padding: 1em 2em; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.