Giter Club home page Giter Club logo

multiparser's People

Contributors

dependabot[bot] avatar kzscisoft avatar wk9874 avatar

Watchers

 avatar  avatar  avatar  avatar

multiparser's Issues

Inconsistency between log and file parser usage

Describe the bug

  • Keyword arguments can be provided to log parser but not file parser.
  • You can use a class method as a log parser but not a file parser.

To Reproduce

import multiparser.parsing.file as mp_file_parser
import multiparser
import os
import json
class MyRun:
    
    @mp_file_parser.file_parser
    def _my_parser(
        self,
        input_file: str,
        **__):
        return {}, json.load(input_file)
        
    def _my_callback(
        self,
        data,
        metadata
    ):
        print(data)
        
        
        
    def launch(self):
        """Method which launches the simulation and the monitoring.

        By default calls the three methods above, and sets up a FileMonitor for tracking files.
        """        
        # Start an instance of the file monitor, to keep track of log and results files
        with multiparser.FileMonitor(
        ) as self.file_monitor:
            
            # Monitor each file created by a Vector PostProcessor, and upload results to Simvue if file matches an expected form.
            self.file_monitor.track(
                path_glob_exprs =  "test.json",
                parser_func = self._my_parser,
                callback = self._my_callback
            )
            self.file_monitor.run()
            
myrun = MyRun()          
myrun.launch()

Expected behavior

  • Behaviour of both parser types consistent.
  • Ability to add keyword arguments to file parsers.

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Python version: 3.12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.