1. 20 Dec, 2010 1 commit
    • Iustin Pop's avatar
      Generalise the sepSplit function · 748d5d50
      Iustin Pop authored
      
      
      Currently it works on splitting strings by individual chars, but we
      can generalise it to split lists by list elements, which means we can
      reuse it later in the Text module for splitting both lists of chars by
      '|' or lists of lines by empty newlines. The change also makes the
      code cleaner (uses “null xs” instead of string-specific “xs == ""”).
      
      Note: I tried to rewrite this in a nicer, functional style using
      unfolds, but I failed to account for the final terminator case
      (e.g. ab|cd|) resulting in a valid but empty element.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
      748d5d50
  2. 01 Dec, 2010 1 commit
  3. 24 Nov, 2010 1 commit
  4. 23 Nov, 2010 1 commit
    • Iustin Pop's avatar
      Improve the standard deviation computation · 7570569e
      Iustin Pop authored
      
      
      This does just two passes, instead of three, over the list. This reduces
      the overall runtime well enough (~25%) in some tests, but it's not
      reproducible using profiling, so I don't know how much the function
      itself is being sped-up.
      
      Note: this is written via `seq`s, and not BangPatterns. Since it's just
      one case, adding BangPatterns just for it wasn't a big gain.
      
      Thanks to Lécz Balázs for the impetus to improve this!
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
      7570569e
  5. 02 Sep, 2010 1 commit
    • Iustin Pop's avatar
      Add some more debugging functions · adc5c176
      Iustin Pop authored
      These are just variations of the standard debug, but are provided for
      simpler code, since lazyness is something causing non-computation of
      debug statements.
      adc5c176
  6. 22 Jul, 2010 1 commit
  7. 27 May, 2010 4 commits
    • Iustin Pop's avatar
      Introduce suport for optional keys in JObjects · f36a8028
      Iustin Pop authored
      Some keys are optional in the Ganeti opcodes (e.g. ‘node’ in the
      OpReplaceDisks), and as such we need to transform them in a Maybe value,
      instead of failing.
      
      The patch reworks a bit fromObj and adds maybeFromObj which parses such
      optional values. It then uses it in the opcode reading.
      f36a8028
    • Iustin Pop's avatar
      Replace fromJResult with annotateJResult · c96d44df
      Iustin Pop authored
      This patch removes all old uses of fromJResult with the annotated
      version, and removes the non-annotated version. All JSON parsing points
      should now have annotated errors.
      c96d44df
    • Iustin Pop's avatar
      Add annotations to loadJSArray · c8b662f1
      Iustin Pop authored
      This allows, for example, the RAPI backend to detail which information
      (instance or node data) fails to parse.
      c8b662f1
    • Iustin Pop's avatar
      Change fromObj error messages · 50d26669
      Iustin Pop authored
      Currently fromObj doesn't detail what we're trying to read, which can
      lead to cryptic messages: "Cannot read Int". The patch changes this
      function to annotate the error messages with the key/value we're trying
      to convert, by using a new version of fromJResult.
      
      Since the display of the key in tryFromObj is now redundant (it was
      already redundant in the 'not found' case), we remove it.
      
      The new version of fromJResult (annotateJResult) simply prepends a
      description string to the actual error message.
      50d26669
  8. 25 Feb, 2010 1 commit
  9. 17 Nov, 2009 2 commits
    • Iustin Pop's avatar
      Collapse the statistical functions into one · 185297fa
      Iustin Pop authored
      This allows us to get rid of two duplicate list length computations,
      with a minor speedup.
      185297fa
    • Iustin Pop's avatar
      Specialize the math functions · e27eb8ab
      Iustin Pop authored
      The statistics functions are currently defined as polymorphic with a
      Floating constraint. Changing this to monomorphic on Double type makes
      them stricter and much more performant (~70% speedup). This is a cheap
      way to recoup some of the loses incurred by the recent proliferation of
      metrics.
      e27eb8ab
  10. 06 Nov, 2009 2 commits
    • Iustin Pop's avatar
      Enhance the error reporting for Rapi and Luxi · 117dc2d8
      Iustin Pop authored
      Currently the JSON conversion in Rapi and Luxi are giving something
      like:
        Error: failed to load data. Details:
        Unable to read Double
      
      This doesn't tell one where the error is (in a node specification? and
      which node? etc.). This patch annotates such messages with the owner
      node:
        Error: failed to load data. Details:
        Node 'node1' key 'mtotal': Unable to read Double
      
      For errors during parsing of the node/instance name (unlikely, but
      still), the output is:
        Error: failed to load data. Details:
        Parsing new node key 'name': Unable to read String
      117dc2d8
    • Iustin Pop's avatar
      Change the Utils.fromObj signature · 262f3e6c
      Iustin Pop authored
      Currently the fromObj function takes a JSON object which is then
      converted into a list of (String, JSValue) in which we make a lookup.
      However, most of the callers of this function call it repeatedly on the
      same object, which means we do the object→list conversion repeatedly.
      
      This patch converts it to take directly the list, and converts its
      callers to do the conversion themselves (and only once).
      
      While this is not in the hot-path today, it would be if we ever were to
      process much data over Luxi (or RAPI), and is a good cleanup in any
      case.
      262f3e6c
  11. 18 Oct, 2009 1 commit
    • Iustin Pop's avatar
      Generalise the node/instance listing · c5f7412e
      Iustin Pop authored
      This patch introduces a generic formatTable function (based on, and
      similar to the Ganeti one, but different and more FP in style) and
      changes the node and instance listing to it.
      
      The node list (due to the many variables) is still a little bit hackish
      unfortunately…
      c5f7412e
  12. 16 Oct, 2009 1 commit
  13. 28 Sep, 2009 1 commit
    • Iustin Pop's avatar
      Turn on, and fix, more warnings · fbb95f28
      Iustin Pop authored
      The Makefile was intented to be -Wall and not simply -W, but I missed
      that. This enables more warnings and also enables -Werror (except for
      the tests).
      fbb95f28
  14. 06 Jul, 2009 2 commits
    • Iustin Pop's avatar
      Optimize the Utils.stdDev function · e6f4f05c
      Iustin Pop authored
      This patch optimizes the stdDev function in two respects:
        - first, we don't do sum . map which builds an intermediate list, but
      	instead use a fold over the list to build incrementally the sum;
      	this should reduce both the time and space characteristics, as we
      	have fewer objects created
        - second, we move from “a ^ 2” to “a * a” as the latter has a much
      	simpler implementation and thus a higher performance
      
      Since the ‘square’ function is obsoleted by the above the patch also
      removes it.
      e6f4f05c
    • Iustin Pop's avatar
      Fix hlint-generated warnings · 9f6dcdea
      Iustin Pop authored
      This big patch cleans up the code per hlint indications. Many removals
      of extra parentheses, replacements of concat . map with concabtMap,
      extra dollar signs, eta reductions, etc. were performed.
      
      The code still compiles and passes a couple of manual tests on sample
      files. The individual changes are also small enough as to be visually
      easy to confirm.
      9f6dcdea
  15. 11 Jun, 2009 2 commits
    • Iustin Pop's avatar
      Fix 'unused X' warnings · c6484f0b
      Iustin Pop authored
      This removes some unused functions and imports to cleanup the warnings.
      c6484f0b
    • Iustin Pop's avatar
      Fix the various monomorphism warning · 78694255
      Iustin Pop authored
      In a few places (e.g. tryRead or any printf call) it's a little bit hard
      to add the correct type signatures, but in the it is possible to fix
      these warnings (which can bite one in subtle cases).
      78694255
  16. 01 Jun, 2009 4 commits
  17. 22 May, 2009 1 commit
    • Iustin Pop's avatar
      More code reorganizations · e4c5beaf
      Iustin Pop authored
      This new big patch does a couple of more cleanups in the loading of data
      chapter:
        - introduce a Types module that holds most types (except the base
          Node/Instance/etc.) so that multiple other modules can use these
          (instead of only Cluster and its users)
        - bring IAlloc.hs in line with the recent changes of providing data
          types and not strings
        - removal of obsolete Utils.hs json-related functions
      e4c5beaf
  18. 21 May, 2009 1 commit
    • Iustin Pop's avatar
      Initial work on hail · 585d4420
      Iustin Pop authored
      This makes hail compile and get a request parsed via IAlloc, but nothing
      more.
      585d4420
  19. 20 May, 2009 2 commits
    • Iustin Pop's avatar
      Generalize some Result function into monad ones · 5aa48dbe
      Iustin Pop authored
      We don't really needed, but is more clean like this.
      5aa48dbe
    • Iustin Pop's avatar
      Switch from hand-written monads to a real one · 942403e6
      Iustin Pop authored
      This big patch converts from our home-grown monad-like constructs
      (the Either stuff) to a real, Either-like-but-another-name monad.
      
      We introduce a “Result a” monad, and this allows dropping many of the
      extra constructs. Hopefully the code is also more clear.
      
      Many of the functions could now be written in a generic-monad style,
      instead of Result specifically, but that will come in future patches.
      
      IAlloc.hs also has some unrelated patches.
      942403e6
  20. 19 May, 2009 1 commit
    • Iustin Pop's avatar
      Add support for 'offline' nodes · 00b15752
      Iustin Pop authored
      This patch drops compatiblity with Ganeti 1.2 and adds support for
      offline nodes in the cluster. When reading from RAPI, the drained nodes
      are considered offline so that we don't allocate on them too.
      00b15752
  21. 18 May, 2009 2 commits
    • Iustin Pop's avatar
      Update the IAlloc module · 3f6af65c
      Iustin Pop authored
      We know have a working parseData function that returns the node and
      instance data. This uncovered bad support for non-drbd instances 
      3f6af65c
    • Iustin Pop's avatar
      Move the JSON utilities to Utils.hs · 9ba5c28f
      Iustin Pop authored
      This patch moves the generic/reusable JSON functions to Utils.hs, so
      that they're shared between RAPI/IAlloc.
      9ba5c28f
  22. 16 Apr, 2009 1 commit
  23. 22 Mar, 2009 1 commit
    • Iustin Pop's avatar
      Split common CLI functionality into a module · 209b3711
      Iustin Pop authored
      This patch moves the common CLI functionality (as much as currently
      possible) into a separate module. This means we only have one parseOpts
      and that Utils.hs doesn't keep this kind of functions anymore.
      209b3711
  24. 20 Mar, 2009 1 commit
  25. 14 Mar, 2009 1 commit
  26. 14 Feb, 2009 1 commit
    • Iustin Pop's avatar
      Add RAPI support to hn1 · dd4c56ed
      Iustin Pop authored
      This patch moves a function to Utils and changes hn1 to be able to take
      data from RAPI.
      dd4c56ed
  27. 13 Feb, 2009 1 commit
  28. 28 Jan, 2009 1 commit