Skip to content

Conversation

@gpauloski
Copy link
Collaborator

@gpauloski gpauloski commented Apr 16, 2024

Description

Rather than just fix the conversion, I've changed the Metrics class to take ms directly as input because it also returns ms. This keeps the units consistent to prevent confusion in calling code.

Fixes

Type of Change

  • Breaking Change (fix or enhancement which changes existing semantics of the public interface)
  • Enhancement (new features or improvements to existing functionality)
  • Bug (fixes for a bug or issue)
  • Internal (refactoring, style changes, testing, optimizations)
  • Documentation update (changes to documentation or examples)
  • Package (dependencies, versions, package metadata)
  • Development (CI workflows, pre-commit, linters, templates)
  • Security (security related changes)

Testing

Updated the unit tests and used the following script to validate (1) main records the time wrong and (2) this branch does it right.

import os
import pprint
import tempfile
import time

from proxystore.connectors.file import FileConnector
from proxystore.store import Store

with tempfile.TemporaryDirectory() as tmp_dir:
    start = time.perf_counter_ns()
    with open(os.path.join(tmp_dir, 'test'), 'w') as f:
        f.write('value')
    end = time.perf_counter_ns()

    print('Write time (ms):', (end - start) / 1000_000)


with tempfile.TemporaryDirectory() as tmp_dir:
    with Store('test', FileConnector(tmp_dir), metrics=True) as store:
        key = store.put('value')
        store.get(key)

        pprint.pprint(store.metrics.get_metrics(key))import os

The times for Write time (ms) and store.put.connector should be similar (and not off by 1000x).

Pull Request Checklist

Please confirm the PR meets the following requirements.

  • Tags added to PR (e.g., breaking, bug, enhancement, internal, documentation, package, development, security).
  • Code changes pass pre-commit (e.g., mypy, ruff, etc.).
  • Tests have been added to show the fix is effective or that the new feature works.
  • New and existing unit tests pass locally with the changes.
  • Docs have been updated and reviewed if relevant.

@gpauloski gpauloski added the bug Error, flaw, or fault that causes unexpected behavior label Apr 16, 2024
Rather than just fix the conversion, I've changed the Metrics class to
take ms directly as input because it also returns ms. This keeps the
units consistent to prevent confusion in calling code.
@gpauloski gpauloski merged commit f9d6239 into main Apr 16, 2024
@gpauloski gpauloski deleted the issue-535 branch April 16, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Error, flaw, or fault that causes unexpected behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metrics for Store instances incorrectly converts NS to MS

2 participants