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

[Playground][Frontend] Run timer fix; CodeRunner and OutputType extraction. #24871

Merged
merged 20 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 19 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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class PlaygroundDemoWidget extends StatelessWidget {
first: SnippetEditor(
controller: snippetController,
isEditable: true,
goToContextLine: false,
),
second: OutputWidget(
playgroundController: playgroundController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final kClearOutputShortcut = BeamShortcut(
onInvoke: (_) => Provider.of<PlaygroundController>(
context,
listen: false,
).clearOutput(),
).codeRunner.clearResult(),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class _CloseListenerState extends State<CloseListener> {
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
html.window.onBeforeUnload.listen((event) async {
Provider.of<PlaygroundController>(context, listen: false).cancelRun();
Provider.of<PlaygroundController>(context, listen: false)
.codeRunner
.cancelRun();
});
});
super.initState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class CodeTextAreaWrapper extends StatelessWidget {

@override
Widget build(BuildContext context) {
if (playgroundController.result?.errorMessage?.isNotEmpty ?? false) {
if (playgroundController.codeRunner.result?.errorMessage?.isNotEmpty ??
false) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_handleError(context, playgroundController);
});
Expand Down Expand Up @@ -83,11 +84,11 @@ class CodeTextAreaWrapper extends StatelessWidget {
void _handleError(BuildContext context, PlaygroundController controller) {
PlaygroundComponents.toastNotifier.add(
Toast(
description: controller.result?.errorMessage ?? '',
description: controller.codeRunner.result?.errorMessage ?? '',
title: AppLocalizations.of(context)!.runCode,
type: ToastType.error,
),
);
controller.resetError();
controller.resetErrorMessageText();
}
}
2 changes: 1 addition & 1 deletion playground/frontend/lib/utils/analytics_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'package:playground_components/playground_components.dart';

String getAnalyticsExampleName(PlaygroundController controller) {
final customCodeName = 'Custom code, sdk ${controller.sdk?.title}';
if (controller.isExampleChanged) {
if (controller.codeRunner.isExampleChanged) {
return customCodeName;
}
return controller.selectedExample?.path ?? customCodeName;
Expand Down
89 changes: 81 additions & 8 deletions playground/frontend/playground_components/assets/symbols/go.g.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
- Fatalf
- Fatalln
- FetchSize
- FieldIndexByTag
- File
- Flatten
- FreeDiskSpace
Expand Down Expand Up @@ -348,6 +349,7 @@
- ImpulseValue
- InboundTagToNode
- Include
- InferFieldNames
- Info
- Infof
- Infoln
Expand Down Expand Up @@ -751,6 +753,7 @@
- SkipK
- SkipPtr
- SkipW
- SklearnModel
- Smallest
- SmallestPerKey
- Source
Expand Down Expand Up @@ -887,11 +890,18 @@
- Warnf
- Warnln
- WindowInto
- WithArgs
- WithContext
- WithContextf
- WithExpansionAddr
- WithExtraPackages
- WithIndexes
- WithQueryLocation
- WithReadBucketAuto
- WithReadBundleSize
- WithReadFilter
- WithWriteBatchSize
- WithWriteOrdered
- Wrap
- WrapIterable
- WrapMethods
Expand Down Expand Up @@ -1401,6 +1411,10 @@ CancelJobResponse:
- String
properties:
- State
Checkpoint:
properties:
- Reapply
- SR
Class:
methods:
- String
Expand Down Expand Up @@ -1668,7 +1682,6 @@ DataSink:
- UID
DataSource:
methods:
- Checkpoint
- Down
- FinishBundle
- ID
Expand Down Expand Up @@ -1749,6 +1762,25 @@ Discard:
- Up
properties:
- UID
DiscoverSchemaTransformRequest:
methods:
- Descriptor
- ProtoMessage
- ProtoReflect
- Reset
- String
DiscoverSchemaTransformResponse:
methods:
- Descriptor
- GetError
- GetSchemaTransformConfigs
- ProtoMessage
- ProtoReflect
- Reset
- String
properties:
- Error
- SchemaTransformConfigs
DisplayData:
methods:
- Descriptor
Expand Down Expand Up @@ -2173,6 +2205,7 @@ ExpansionResponse:
- Transform
ExpansionServiceClient:
methods:
- DiscoverSchemaTransform
- Expand
ExpansionServiceRunner:
methods:
Expand All @@ -2182,6 +2215,7 @@ ExpansionServiceRunner:
- String
ExpansionServiceServer:
methods:
- DiscoverSchemaTransform
- Expand
ExternalConfigurationPayload:
methods:
Expand Down Expand Up @@ -3195,6 +3229,7 @@ JobOptions:
- Region
- RetainDocker
- ServiceAccountEmail
- Streaming
- Subnetwork
- TeardownPolicy
- TempLocation
Expand All @@ -3203,7 +3238,6 @@ JobOptions:
- Update
- Worker
- WorkerHarnessThreads
- WorkerJar
- WorkerRegion
- WorkerZone
- Zone
Expand Down Expand Up @@ -3381,6 +3415,7 @@ LockRTracker:
- GetRestriction
- IsBounded
- IsDone
- String
- TryClaim
- TrySplit
properties:
Expand Down Expand Up @@ -4237,6 +4272,10 @@ PlanSnapshot:
Port:
properties:
- URL
PredictionResult:
properties:
- Example
- Inference
PrepareJobRequest:
methods:
- Descriptor
Expand Down Expand Up @@ -4694,6 +4733,11 @@ ReadModifyWriteStateSpec:
- String
properties:
- CoderId
ReadOption:
properties:
- BucketAuto
- BundleSize
- Filter
ReadOptions:
properties:
- IDAttribute
Expand Down Expand Up @@ -4947,6 +4991,34 @@ SchemaProvider:
- BuildDecoder
- BuildEncoder
- FromLogicalType
SchemaTransformConfig:
methods:
- Descriptor
- GetConfigSchema
- GetInputPcollectionNames
- GetOutputPcollectionNames
- ProtoMessage
- ProtoReflect
- Reset
- String
properties:
- ConfigSchema
- InputPcollectionNames
- OutputPcollectionNames
SchemaTransformPayload:
methods:
- Descriptor
- GetConfigurationRow
- GetConfigurationSchema
- GetIdentifier
- ProtoMessage
- ProtoReflect
- Reset
- String
properties:
- ConfigurationRow
- ConfigurationSchema
- Identifier
Scope:
methods:
- ID
Expand Down Expand Up @@ -5153,6 +5225,7 @@ SplitResult:
- RI
- RS
- TId
- Unsuccessful
SplittableDoFn:
methods:
- CreateInitialRestrictionFn
Expand Down Expand Up @@ -6016,6 +6089,7 @@ Tracker:
- GetRestriction
- IsBounded
- IsDone
- String
- TryClaim
- TrySplit
Transaction:
Expand Down Expand Up @@ -6304,7 +6378,6 @@ TypeMismatchError:
- Error
properties:
- Got
U: {}
UnimplementedArtifactRetrievalServiceServer:
methods:
- GetArtifact
Expand Down Expand Up @@ -6334,6 +6407,7 @@ UnimplementedBeamFnWorkerStatusServer:
- WorkerStatus
UnimplementedExpansionServiceServer:
methods:
- DiscoverSchemaTransform
- Expand
UnimplementedJobServiceServer:
methods:
Expand Down Expand Up @@ -6397,7 +6471,6 @@ UserFn:
UserStateAdapter:
methods:
- NewStateProvider
V: {}
Value:
methods:
- Clear
Expand All @@ -6409,7 +6482,6 @@ Value:
- Write
properties:
- Key
W: {}
WallTimeWatermarkEstimator:
methods:
- CurrentWatermark
Expand Down Expand Up @@ -6560,9 +6632,10 @@ WriteFilesPayload:
- SideInputs
- Sink
- WindowedWrites
WriteOption:
properties:
- BatchSize
- Ordered
Writer:
methods:
- SaveData
X: {}
"Y": {}
Z: {}
Loading