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

user-defined upsampling resolution #990

Conversation

mouhamadalmounayar
Copy link
Contributor

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

A description of the changes proposed in the Pull Request

Added the possibility to provide a custom upsampling resolution to time-sync in the model config.

  • If no upsampling resolution is provided, it defaults to 1s
  • If upsampling resolution does not meet criteria a Config Error is thrown.

@mouhamadalmounayar mouhamadalmounayar force-pushed the custom-upsampling-resolution branch 2 times, most recently from 020178b to 13ee8dc Compare August 23, 2024 11:49
@zanete zanete linked an issue Aug 27, 2024 that may be closed by this pull request
@jmcook1186
Copy link
Contributor

Hi @mouhamadalmounayar sorry for the delay reviewing this - we're just fixing another bug we found in time-sync before incorporating your PR.

@manushak
Copy link
Contributor

Hi @mouhamadalmounayar I’ve reviewed the PR and it works well with simple time series like:

{timestamp: '2023-12-12T00:00:00.000Z', duration: 300}

However, it throws a defined error in more complex cases, such as this manifest

name: time-sync
description: successful path
tags:
initialize:
  output:
    - yaml
  plugins:
    'time-sync':
      method: TimeSync
      path: 'builtin'
      config:
        start-time: '2023-12-12T00:00:00.000Z'
        end-time: '2023-12-12T00:01:00.000Z'
        interval: 5
        allow-padding: true
        upsampling-resolution: 5
      parameter-metadata:
        outputs:
          energy-cpu:
            unit: KWH
            description: energy
            aggregation-method: sum
tree:
  children:
    child:
      pipeline:
        compute:
          - time-sync
      inputs:
        - timestamp: '2023-12-12T00:00:00.000Z'
          duration: 1
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:01.000Z'
          duration: 5
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:06.000Z'
          duration: 7
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:13.000Z'
          duration: 30
          energy-cpu: 0.001

Could you please take a look and fix it?

@mouhamadalmounayar
Copy link
Contributor Author

Hi @manushak, since the upsampling resolution is set to 5s which is greater than a duration for an input here, 1s, it seems it's normal to fail no ?

@manushak
Copy link
Contributor

@mouhamadalmounayar, you’re right. I’ve updated the manifest but still get the same error. The durations are now 5, 7, and 30.

name: time-sync
description: successful path
tags:
initialize:
  output:
    - yaml
  plugins:
    'time-sync':
      method: TimeSync
      path: 'builtin'
      config:
        start-time: '2023-12-12T00:00:01.000Z'
        end-time: '2023-12-12T00:01:00.000Z'
        interval: 5
        allow-padding: true
        upsampling-resolution: 5
      parameter-metadata:
        outputs:
          energy-cpu:
            unit: KWH
            description: energy
            aggregation-method: sum
tree:
  children:
    child:
      pipeline:
        compute:
          - time-sync
      inputs:
        - timestamp: '2023-12-12T00:00:01.000Z'
          duration: 5
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:06.000Z'
          duration: 7
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:13.000Z'
          duration: 30
          energy-cpu: 0.001

@mouhamadalmounayar
Copy link
Contributor Author

@manushak This is also normal according to the constraints needed for the upsampling resolution. For the upsampling resolution not to cause issues for resampling it needs to be a divisor of all the durations, the interval and the paddings. 7 % 5 != 0. If you try a duration of 10 instead of 7 it should work. I discussed this with @jmcook1186 here #354

@narekhovhannisyan
Copy link
Member

@mouhamadalmounayar Also we had changes on time sync after your PR which have fixed bugs. So please rebase your branch and resolve the conflicts.

@mouhamadalmounayar mouhamadalmounayar force-pushed the custom-upsampling-resolution branch from 13ee8dc to e22feb8 Compare September 18, 2024 18:16
@narekhovhannisyan
Copy link
Member

@mouhamadalmounayar I'm unable to run the following manifest (seems all constraints are preserved in this case):

name: time-sync
description: successful path
tags:
initialize:
  output:
    - yaml
  plugins:
    'time-sync':
      method: TimeSync
      path: 'builtin'
      config:
        start-time: '2023-12-12T00:00:00.000Z'
        end-time: '2023-12-12T00:01:00.000Z'
        interval: 5
        allow-padding: true
        upsampling-resolution: 5
      parameter-metadata:
        outputs:
          energy-cpu:
            unit: KWH
            description: energy
            aggregation-method: 
              time: sum
              component: sum
tree:
  children:
    child:
      pipeline:
        compute:
          - time-sync
      inputs:
        - timestamp: '2023-12-12T00:00:00.000Z'
          duration: 5
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:06.000Z'
          duration: 10
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:16.000Z'
          duration: 30
          energy-cpu: 0.001

can you please check?

@mouhamadalmounayar
Copy link
Contributor Author

mouhamadalmounayar commented Sep 21, 2024

@mouhamadalmounayar I'm unable to run the following manifest (seems all constraints are preserved in this case):

name: time-sync
description: successful path
tags:
initialize:
  output:
    - yaml
  plugins:
    'time-sync':
      method: TimeSync
      path: 'builtin'
      config:
        start-time: '2023-12-12T00:00:00.000Z'
        end-time: '2023-12-12T00:01:00.000Z'
        interval: 5
        allow-padding: true
        upsampling-resolution: 5
      parameter-metadata:
        outputs:
          energy-cpu:
            unit: KWH
            description: energy
            aggregation-method: 
              time: sum
              component: sum
tree:
  children:
    child:
      pipeline:
        compute:
          - time-sync
      inputs:
        - timestamp: '2023-12-12T00:00:00.000Z'
          duration: 5
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:06.000Z'
          duration: 10
          energy-cpu: 0.001
        - timestamp: '2023-12-12T00:00:16.000Z'
          duration: 30
          energy-cpu: 0.001

can you please check?

@narekhovhannisyan For this manifest, there is a gap of 1s between the first and second input which time-sync is trying to fill with a 5s input which is not possible. That is why an error is thrown.

@narekhovhannisyan
Copy link
Member

@mouhamadalmounayar ok makes sense, in that case, can we have more granular error messages so they will state what's wrong ? Currently error message is the same for all cases: Upsampling resolution does not adhere to all constraints.

@mouhamadalmounayar
Copy link
Contributor Author

@mouhamadalmounayar ok makes sense, in that case, can we have more granular error messages so they will state what's wrong ? Currently error message is the same for all cases: Upsampling resolution does not adhere to all constraints.

yes, on it.

@narekhovhannisyan narekhovhannisyan merged commit 9e08d52 into Green-Software-Foundation:main Sep 23, 2024
1 check passed
This was referenced Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add user-defined upsamling resolution to time sync model
4 participants