-
Notifications
You must be signed in to change notification settings - Fork 4
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
More expressive primary service init failure #476
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,10 @@ import edu.ie3.simona.service.{ServiceStateData, SimonaService} | |
import edu.ie3.simona.util.TickUtil.{RichZonedDateTime, TickLong} | ||
import edu.ie3.util.scala.collection.immutable.SortedDistinctSeq | ||
|
||
import java.io.IOException | ||
import java.nio.file.Path | ||
import java.time.ZonedDateTime | ||
import java.time.format.DateTimeParseException | ||
import java.util.UUID | ||
import scala.jdk.CollectionConverters._ | ||
import scala.jdk.OptionConverters.RichOptional | ||
|
@@ -78,15 +80,30 @@ final case class PrimaryServiceWorker[V <: Value]( | |
Try { | ||
/* Set up source and acquire information */ | ||
val factory = new TimeBasedSimpleValueFactory(valueClass, timePattern) | ||
val source = new CsvTimeSeriesSource( | ||
csvSep, | ||
directoryPath, | ||
fileNamingStrategy, | ||
timeSeriesUuid, | ||
filePath, | ||
valueClass, | ||
factory | ||
) | ||
val source = Try( | ||
new CsvTimeSeriesSource( | ||
csvSep, | ||
directoryPath, | ||
fileNamingStrategy, | ||
timeSeriesUuid, | ||
filePath, | ||
valueClass, | ||
factory | ||
) | ||
) match { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This error matching would also be nice for SqlTimeSeriesSource as well, no? So maybe we can move this an abstraction level upwards, i.e. checking for |
||
case Failure(exc: DateTimeParseException) => | ||
throw new IOException( | ||
s"Could not initiate the time series source. Parsing ${exc.getParsedString} failed with timepattern: $timePattern. The time pattern can be configured in the configuration.", | ||
exc | ||
) | ||
Comment on lines
+94
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want this kind of distinction, would'nt it rather make sense to have it in PSDM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly solved here (or with an earlier PR). We should still check if |
||
case Failure(exc) => | ||
throw new IOException( | ||
s"Could not initiate the time series source.", | ||
exc | ||
) | ||
case Success(source) => | ||
source | ||
} | ||
(source, simulationStart) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the default time pattern, so this line effectively does not change any configuraiton. Does it make sense to include it?