I've spent a year writing a book and still probably have a year to go. And all of this work may be wasted, if I don't get published. Should I contact agents/publishers now to garner their interest to see if there is any point in finishing my book? Is that a thing that is done?
If your book is fiction, it must be finished before an agent or editor will consider it. They are not going to invest any time or effort in an unfinished project by an unknown and unproven writer. After all, many novels never do get satisfactorily finished, and they already have a superabundance of finished novels in their slush piles to consider.
On the other hand, if it is non-fiction, you should query an agent or publisher before you even start writing. To query them, you will need to create a book proposal, which is a significant project in its own right. (You can find lots of information on creating non-fiction book proposals online.) Only when you have negotiated the details and scope of the book with the publisher based on the book proposal do you actually sit down and write it. (Though some may want to see some sample chapters with the book proposal.)
The big difference between fiction and non-fiction publishing is that fiction is published entirely on the merits of the finished book. No one cares what your qualification are, as long as you wrote a good book. For non-fiction, through, books are published largely on the qualifications and/or platform of the author. A finished novel is the only proof that you can write a good novel. A book proposal is the best way to establish that you have the qualifications and/or platform to write creditable non-fiction book.