Skip to content

Commit

Permalink
Merge branch 'master' of github.com:scalableminds/webknossos into org…
Browse files Browse the repository at this point in the history
…a_owner

* 'master' of github.com:scalableminds/webknossos:
  Loki batched insert (#6831)
  Fix editable text style (#6799)
  Fix dbtool schema scheck stderr capturing (#6830)
  Release 23.02.1 (#6827)
  • Loading branch information
hotzenklotz committed Feb 8, 2023
2 parents 788bee8 + 6d6cb36 commit 5dd39a2
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 148 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.released.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Calendar Versioning](http://calver.org/) `0Y.0M.MICRO`.
For upgrade instructions, please check the [migration guide](MIGRATIONS.released.md).

## [23.02.1](https://github.com/scalableminds/webknossos/releases/tag/23.02.1) - 2023-02-07
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.0...23.02.1)

### Fixed
- Fixed a benign error message which briefly appeared after logging in. [#6810](https://github.com/scalableminds/webknossos/pull/6810)

## [23.02.0](https://github.com/scalableminds/webknossos/releases/tag/23.02.0) - 2023-02-01
[Commits](https://github.com/scalableminds/webknossos/compare/23.01.0...23.02.0)

Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Calendar Versioning](http://calver.org/) `0Y.0M.MIC
For upgrade instructions, please check the [migration guide](MIGRATIONS.released.md).

## Unreleased
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.0...HEAD)
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.1...HEAD)

### Added
- Remote datasets can now also be streamed from Google Cloud Storage URIs (`gs://`). [#6775](https://github.com/scalableminds/webknossos/pull/6775)
Expand All @@ -19,9 +19,9 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Added owner name to organization page. [#6811](https://github.com/scalableminds/webknossos/pull/6811)

### Fixed
- Fixed a benign error message which briefly appeared after logging in. [#6810](https://github.com/scalableminds/webknossos/pull/6810)
- Fixed saving allowed teams in dataset settings. [#6817](https://github.com/scalableminds/webknossos/pull/6817)
- Fixed log streaming in Voxelytics workflow reports. [#6828](https://github.com/scalableminds/webknossos/pull/6828)
- Fixed log streaming in Voxelytics workflow reports. [#6828](https://github.com/scalableminds/webknossos/pull/6828) [#6831](https://github.com/scalableminds/webknossos/pull/6831)
- Fixed some layouting issues with line breaks in segment list/dataset info tab [#6799](https://github.com/scalableminds/webknossos/pull/6799)

### Removed

Expand Down
8 changes: 7 additions & 1 deletion MIGRATIONS.released.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ See `MIGRATIONS.unreleased.md` for the changes which are not yet part of an offi
This project adheres to [Calendar Versioning](http://calver.org/) `0Y.0M.MICRO`.
User-facing changes are documented in the [changelog](CHANGELOG.released.md).

## [23.02.1](https://github.com/scalableminds/webknossos/releases/tag/23.02.1) - 2023-02-07
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.0...23.02.1)

### Postgres Evolutions:
None.

## [23.02.0](https://github.com/scalableminds/webknossos/releases/tag/23.02.0) - 2023-02-01
[Commits](https://github.com/scalableminds/webknossos/compare/23.01.0...23.02.0)

Expand Down Expand Up @@ -511,4 +517,4 @@ No migrations necessary.
## [18.07.0](https://github.com/scalableminds/webknossos/releases/tag/18.07.0) - 2018-07-05
First release
First release
2 changes: 1 addition & 1 deletion MIGRATIONS.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This project adheres to [Calendar Versioning](http://calver.org/) `0Y.0M.MICRO`.
User-facing changes are documented in the [changelog](CHANGELOG.released.md).

## Unreleased
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.0...HEAD)
[Commits](https://github.com/scalableminds/webknossos/compare/23.02.1...HEAD)

- WEBKNOSSOS now requires Node.js not only for development and building, but also for execution. The prebuilt Docker images already contain this dependency. If you're using these, nothing needs to be changed. [#6803](https://github.com/scalableminds/webknossos/pull/6803)

Expand Down
7 changes: 4 additions & 3 deletions app/Startup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,22 @@ class Startup @Inject()(actorSystem: ActorSystem,

val errorMessageBuilder = mutable.ListBuffer[String]()
val capturingProcessLogger =
ProcessLogger((o: String) => errorMessageBuilder.append(o), (e: String) => logger.error(e))
ProcessLogger((o: String) => errorMessageBuilder.append(o), (e: String) => errorMessageBuilder.append(e))

val result = Process("./tools/postgres/dbtool.js check-db-schema", None, "POSTGRES_URL" -> postgresUrl) ! capturingProcessLogger
if (result == 0) {
logger.info("Database schema is up to date.")
} else {
val errorMessage = errorMessageBuilder.toList.mkString("\n")
logger.error(errorMessage)
logger.error("dbtool: " + errorMessage)
slackNotificationService.warn("SQL schema mismatch", errorMessage)
}
}

private def ensurePostgresDatabase(): Unit = {
logger.info(s"Ensuring Postgres database…")
val processLogger = ProcessLogger((o: String) => logger.info(o), (e: String) => logger.error(e))
val processLogger =
ProcessLogger((o: String) => logger.info(s"dbtool: $o"), (e: String) => logger.error(s"dbtool: $e"))

// this script is copied to the stage directory in AssetCompilation
val result = Process("./tools/postgres/dbtool.js ensure-db", None, "POSTGRES_URL" -> postgresUrl) ! processLogger
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/VoxelyticsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class VoxelyticsController @Inject()(
_ <- bool2Fox(wkConf.Features.voxelyticsEnabled) ?~> "voxelytics.disabled"
organization <- organizationDAO.findOne(request.identity._organization)
logEntries = request.body
_ <- lokiClient.bulkInsert(logEntries, organization._id)
_ <- lokiClient.bulkInsertBatched(logEntries, organization._id)
} yield Ok
}

Expand All @@ -257,7 +257,7 @@ class VoxelyticsController @Inject()(
minLevel: Option[String],
startTimestamp: Long,
endTimestamp: Long,
limit: Option[Long]): Action[AnyContent] =
limit: Option[Int]): Action[AnyContent] =
sil.SecuredAction.async { implicit request =>
{
for {
Expand Down
31 changes: 19 additions & 12 deletions app/models/voxelytics/LokiClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class LokiClient @Inject()(wkConf: WkConf, rpc: RPC, val system: ActorSystem)(im

private val POLLING_INTERVAL = 1 second
private val LOG_TIME_BATCH_INTERVAL = 1 days
private val LOG_ENTRY_BATCH_SIZE = 5000L
private val LOG_ENTRY_QUERY_BATCH_SIZE = 5000
private val LOG_ENTRY_INSERT_BATCH_SIZE = 1000

private lazy val serverStartupFuture: Fox[Unit] = {
for {
Expand Down Expand Up @@ -83,7 +84,7 @@ class LokiClient @Inject()(wkConf: WkConf, rpc: RPC, val system: ActorSystem)(im
minLevel: VoxelyticsLogLevel = VoxelyticsLogLevel.INFO,
startTime: Instant,
endTime: Instant,
limit: Option[Long]): Fox[List[JsValue]] = {
limit: Option[Int]): Fox[List[JsValue]] = {
val currentEndTime = endTime
val currentStartTime = startTime.max(endTime - LOG_TIME_BATCH_INTERVAL)

Expand All @@ -94,10 +95,10 @@ class LokiClient @Inject()(wkConf: WkConf, rpc: RPC, val system: ActorSystem)(im
minLevel,
currentStartTime,
currentEndTime,
limit.getOrElse(LOG_ENTRY_BATCH_SIZE).min(LOG_ENTRY_BATCH_SIZE))
limit.getOrElse(LOG_ENTRY_QUERY_BATCH_SIZE).min(LOG_ENTRY_QUERY_BATCH_SIZE))
newLimit = limit.map(l => (l - headBatch.length).max(0))
buffer <- if (headBatch.isEmpty) {
if (currentStartTime == startTime || newLimit.contains(0L)) {
if (currentStartTime == startTime || newLimit.contains(0)) {
Fox.successful(List())
} else {
for {
Expand Down Expand Up @@ -130,13 +131,13 @@ class LokiClient @Inject()(wkConf: WkConf, rpc: RPC, val system: ActorSystem)(im
} yield buffer
}

def queryLogs(runName: String,
organizationId: ObjectId,
taskName: Option[String],
minLevel: VoxelyticsLogLevel = VoxelyticsLogLevel.INFO,
startTime: Instant,
endTime: Instant,
limit: Long): Fox[List[JsValue]] = {
private def queryLogs(runName: String,
organizationId: ObjectId,
taskName: Option[String],
minLevel: VoxelyticsLogLevel,
startTime: Instant,
endTime: Instant,
limit: Int): Fox[List[JsValue]] = {
val levels = VoxelyticsLogLevel.sortedValues.drop(VoxelyticsLogLevel.sortedValues.indexOf(minLevel))

val logQLFilter = List(
Expand Down Expand Up @@ -171,7 +172,13 @@ class LokiClient @Inject()(wkConf: WkConf, rpc: RPC, val system: ActorSystem)(im
} yield logEntries
}

def bulkInsert(logEntries: List[JsValue], organizationId: ObjectId)(implicit ec: ExecutionContext): Fox[Unit] =
def bulkInsertBatched(logEntries: List[JsValue], organizationId: ObjectId)(implicit ec: ExecutionContext): Fox[Unit] =
for {
_ <- Fox.serialCombined(logEntries.grouped(LOG_ENTRY_INSERT_BATCH_SIZE).toList)(bulkInsert(_, organizationId))
} yield ()

private def bulkInsert(logEntries: List[JsValue], organizationId: ObjectId)(
implicit ec: ExecutionContext): Fox[Unit] =
if (logEntries.nonEmpty) {
for {
_ <- serverStartupFuture
Expand Down
2 changes: 1 addition & 1 deletion conf/webknossos.latest.routes
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@ POST /voxelytics/workflows/:workflowHash/events
GET /voxelytics/workflows/:workflowHash/chunkStatistics controllers.VoxelyticsController.getChunkStatistics(workflowHash: String, runId: Option[String], taskName: String)
GET /voxelytics/workflows/:workflowHash/artifactChecksums controllers.VoxelyticsController.getArtifactChecksums(workflowHash: String, runId: Option[String], taskName: String, artifactName: Option[String])
POST /voxelytics/logs controllers.VoxelyticsController.appendLogs
GET /voxelytics/logs controllers.VoxelyticsController.getLogs(runId: String, taskName: Option[String], minLevel: Option[String], startTimestamp:Long, endTimestamp: Long, limit: Option[Long])
GET /voxelytics/logs controllers.VoxelyticsController.getLogs(runId: String, taskName: Option[String], minLevel: Option[String], startTimestamp:Long, endTimestamp: Long, limit: Option[Int])
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/dataset/dataset_upload_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ class DatasetUploadView extends React.Component<PropsWithFormAndRouter, State> {
width: 400,
}}
allowDecimals
onChange={(scale) => {
onChange={(scale: Vector3) => {
if (this.formRef.current == null) return;
this.formRef.current.setFieldsValue({
scale,
Expand Down
6 changes: 3 additions & 3 deletions frontend/javascripts/components/text_with_description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import Markdown from "react-remarkable";
import * as React from "react";
import type { EditableTextLabelProp } from "oxalis/view/components/editable_text_label";
import EditableTextLabel from "oxalis/view/components/editable_text_label";

type EditableProps = EditableTextLabelProp & {
isEditable: true;
description: string;
};
type NonEditableProps = {
markdown?: boolean;
isEditable: false;
description: string;
value: string;
Expand Down Expand Up @@ -61,8 +63,7 @@ class TextWithDescription extends React.PureComponent<Props> {
</Tooltip>
) : null}
</span>
{/* @ts-expect-error ts-migrate(2322) FIXME: Type 'string | null' is not assignable to type 'st... Remove this comment to see the full error message */}
<span className={hasDescription ? "flex-item" : null}>
<span className={hasDescription ? "flex-item" : undefined}>
{isEditable ? (
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
<EditableTextLabel {...editableProps} />
Expand All @@ -73,7 +74,6 @@ class TextWithDescription extends React.PureComponent<Props> {
display: "inline-block",
}}
>
{/* @ts-expect-error ts-migrate(2339) FIXME: Property 'markdown' does not exist on type 'Readon... Remove this comment to see the full error message */}
{this.props.markdown ? (
<Markdown
source={this.props.value}
Expand Down
17 changes: 10 additions & 7 deletions frontend/javascripts/libs/vector_input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ import * as React from "react";
import _ from "lodash";
import type { ServerBoundingBoxTypeTuple } from "types/api_flow_types";
import type { Vector3, Vector6 } from "oxalis/constants";
import InputComponent, { InputComponentProps } from "oxalis/view/components/input_component";
import InputComponent, {
InputComponentCommonProps,
InputElementProps,
} from "oxalis/view/components/input_component";
import * as Utils from "libs/utils";

type BaseProps<T> = Omit<InputComponentProps, "value"> & {
type BaseProps<T> = Omit<InputComponentCommonProps & InputElementProps, "value" | "onChange"> & {
value: T | string;
onChange: (value: T) => void;
changeOnlyOnBlur?: boolean;
allowDecimals?: boolean;
autoSize?: boolean;
};
type State = {
isEditing: boolean;
Expand Down Expand Up @@ -51,7 +55,7 @@ class BaseVector<T extends Vector3 | Vector6> extends React.PureComponent<BasePr
return value;
}

handleBlur = () => {
handleBlur = (_: React.FocusEvent<HTMLInputElement>) => {
this.setState({
isEditing: false,
});
Expand Down Expand Up @@ -89,7 +93,7 @@ class BaseVector<T extends Vector3 | Vector6> extends React.PureComponent<BasePr
return vector;
}

handleFocus = () => {
handleFocus = (_event: React.FocusEvent<HTMLInputElement>) => {
this.setState({
isEditing: true,
text: this.getText(this.props.value),
Expand Down Expand Up @@ -127,7 +131,6 @@ class BaseVector<T extends Vector3 | Vector6> extends React.PureComponent<BasePr

return (
<InputComponent
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
onChange={this.handleChange}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
Expand All @@ -136,6 +139,7 @@ class BaseVector<T extends Vector3 | Vector6> extends React.PureComponent<BasePr
autoSize ? { ...style, width: this.getText(this.state.text).length * 8 + 25 } : style
}
{...props}
isTextArea={false}
/>
);
}
Expand All @@ -147,7 +151,7 @@ export class Vector3Input extends BaseVector<Vector3> {
export class Vector6Input extends BaseVector<Vector6> {
defaultValue: Vector6 = [0, 0, 0, 0, 0, 0];
}
type BoundingBoxInputProps = Omit<InputComponentProps, "value"> & {
type BoundingBoxInputProps = Omit<InputComponentCommonProps & InputElementProps, "value"> & {
value: ServerBoundingBoxTypeTuple;
onChange: (arg0: ServerBoundingBoxTypeTuple) => void;
};
Expand Down Expand Up @@ -179,7 +183,6 @@ export class BoundingBoxInput extends React.PureComponent<BoundingBoxInputProps>
{...props}
value={vector6Value}
changeOnlyOnBlur
// @ts-expect-error ts-migrate(2322) FIXME: Type '([x, y, z, width, height, depth]: [any, any,... Remove this comment to see the full error message
onChange={([x, y, z, width, height, depth]) =>
onChange({
topLeft: [x, y, z],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class DatasetPositionView extends PureComponent<Props> {
</Tooltip>
<Vector3Input
value={position}
// @ts-expect-error ts-migrate(2322) FIXME: Type '(position: Vector3) => void' is not assignab... Remove this comment to see the full error message
onChange={this.handleChangePosition}
autoSize
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ textAlign: string; }' is not assignable to... Remove this comment to see the full error message
Expand Down Expand Up @@ -159,7 +158,6 @@ class DatasetPositionView extends PureComponent<Props> {
</Tooltip>
<Vector3Input
value={rotation}
// @ts-expect-error ts-migrate(2322) FIXME: Type '(rotation: Vector3) => void' is not assignab... Remove this comment to see the full error message
onChange={this.handleChangeRotation}
style={{
textAlign: "center",
Expand Down
Loading

0 comments on commit 5dd39a2

Please sign in to comment.